Home  |  Contents 
Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: Micromite eXtreme Firmware V5.03 Post ReplyPost New Topic
<< Prev Page of 6
Author
Message << Prev Topic | Next Topic >>
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 1573
Posted: 19 April 2017 at 7:54am | IP Logged Quote matherp

Jim

Thanks for that - side effect of implementing the forced exponential format

The Pi version needs updating with all the changes - I'll post something later today

Attached is the latest re-release 5.3.17 for the 100 and 144-pin parts

2017-04-19_075342_MMX5.3.17.zip

And for the 64-pin part

2017-04-19_075239_MMX645.3.17.zip





Back to Top View matherp's Profile Search for other posts by matherp
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2018
Posted: 19 April 2017 at 8:36am | IP Logged Quote TassyJim

That works better!.
I knew I had another program somewhere for engineering notation.
I prefer engineering notation when playing with component values etc.

Here it is
' MicroMite
  'format number in Engineering notation
  ' TassyJim 16 March 2014
  DO
    READ a
    PRINT strE$(a,12,1)
  LOOP UNTIL a = 0
END
  
FUNCTION strE$(mx,p, eng)
  ' mx = number to format
  ' p = number of decimal places
  ' if eng is not zero, use engineering notation
  LOCAL px, sn$, x
  sn$=" "
  x=mx
  IF x < 0 THEN
    sn$ = "-"
    x = x * -1
  ENDIF
  IF x<>0 THEN  ' zero is a special case
    px=INT(LOG(x)/ LOG(10))
    IF eng <> 0 THEN ' engineering notation - multiples of 3
      px = INT(px/3)*3
    ENDIF
    x=x*(10^-px)
    strE$ = sn$ + STR$(x, 0, p) + "e" + STR$(INT(px))
  ELSE
    strE$ = sn$ + STR$(x, 0, p)
  ENDIF
END FUNCTION
  
  DATA      -1.9509150490455762e+04     ,      -1.9101597562906206e+04     ,      -5.3792389600437023e+03
  DATA      2.6745479139695885e+03     ,      -4.1107639233861732e+05     ,      1.8039170525238259e+04
  DATA      -3.0238550029372377e+05     ,      -6.9277505690488060e+03     ,      -1.0253481529116041e+05
  DATA      2.3728918290534584e+03     ,      1.4651420661642793e+05     ,      -5.2052288478643040e+03
  DATA      4.7026247303780471e+04     ,      -1.3249750680520442e+03     ,      1.6002341470107360e+04
  DATA      -1.2968825492757745e+03     ,      -1.4753267662386909e+04     ,      1.6212085558023923e+02
  DATA      -4.0177777613644884e+03     ,      5.4472249566385002e+02     ,      -1.3864294032602171e+03
  DATA      2.0944568417002891e+02     ,      1.3025618648952362e+03     ,      1.8186655290580043e+01
  DATA      4.0800683272180116e+02     ,      -6.1696138184359625e+01     ,      1.4127897903869770e+02
  DATA      -1.6878795485286642e+01     ,      -1.5134023816145989e+02     ,      2.2405113034100004e-01
  DATA      -5.2206627243118069e+01     ,      3.6345097141761684e+00     ,      -1.7920513466880599e+01
  DATA      8.6779646031902207e-01     ,      2.0283413346424432e+01     ,      -3.2320616223538909e-01
  DATA      7.1829675324621513e+00     ,      -1.5021838189568371e-01     ,      2.5567619549789620e+00
  DATA      -3.8447105541958342e-02     ,      -2.7613886906044733e+00     ,      -1.7482108419894107e-03
  DATA      -9.2551550288252251e-01     ,      1.0983875057371777e-02     ,      -3.8803916473850784e-01
  DATA      -2.7603287474318803e-03     ,      3.2272242650062597e-01     ,      1.5775894057393691e-02
  DATA      8.2556945377118182e-02     ,      2.8333855651518594e-03     ,      5.3670717564749610e-02
  DATA      5.0759404395995213e-03     ,      -1.7796021268059985e-02     ,      -3.4995377309747879e-03
  DATA      3.6598594389423460e-03     ,      -3.5999052689432918e-03     ,      -4.7281039878726006e-03
  DATA      -2.4012103261026949e-03     ,      -4.3875247543577895e-03     ,      1.6549131673638753e-04
  DATA      -4.8342686506137911e-03     ,      1.9899465305137534e-03     ,      -4.8041223375808579e-04
  DATA 1, -1, 0


The exponential notation formula is a lot cleaner.

Jim



__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
CaptainBoing
Senior Member
Senior Member
Avatar

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 105
Posted: 19 April 2017 at 8:48am | IP Logged Quote CaptainBoing

Hello Peter/Geoff.

do you have any plans to increase the size of strings in MMBasic now that we have devices that support much larger memories. Even 1K would be nice, 64K would be amazing. I have used the large string support with CFunctions etc but it is a bit "clunky".

just asking

Edited by CaptainBoing on 19 April 2017 at 9:03am


__________________

all you need is duct tape and WD40 (if it moves and shouldn't, use duct tape; if it doesn't move and should, use WD40)
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 1573
Posted: 19 April 2017 at 9:11am | IP Logged Quote matherp

Quote:
do you have any plans to increase the size of strings in MMBasic now that we have devices that support much larger memories.


It would be a huge change which would likely introduce bugs throughout the code. Basic strings are stored with a single character length field in the first location giving lengths of 1 to 255.
Back to Top View matherp's Profile Search for other posts by matherp
 
CaptainBoing
Senior Member
Senior Member
Avatar

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 105
Posted: 19 April 2017 at 10:03am | IP Logged Quote CaptainBoing

I figured as much really - it is sort of "hard baked" in the core of things I guess... dunt hurt to ask though not like its a show stopper.

Thanks Peter.

__________________

all you need is duct tape and WD40 (if it moves and shouldn't, use duct tape; if it doesn't move and should, use WD40)
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing
 
cdeagle
Regular Member
Regular Member


Joined: 22 June 2014
Location: United States
Online Status: Offline
Posts: 92
Posted: 20 April 2017 at 11:14am | IP Logged Quote cdeagle

There's a problem when printing zero with the new STR$ function. Notice the "exponent" on the "position vector z-component" in the following program output.

program npoe - numerical prediction of orbital events
-----------------------------------------------------

degree of gravity model 2
order of gravity model 0

integration tolerance 1.00000e-08
root-finding tolerance 0.0001

initial conditions
------------------

calendar date April 18 2017

UTC 0 hours 0 minutes 0.00 seconds

position vector x-component 5.506706064204379e+03 kilometers
position vector y-component 5.506706064204379e+03 kilometers
position vector z-component 0.000000000000000e--2147483648 kilometers

position vector magnitude 7.787658400000000e+03 kilometers

velocity vector x-component -4.504405239129656e+00 kilometers/second
velocity vector y-component 4.504405239129657e+00 kilometers/second
velocity vector z-component 3.458731500160038e+00 kilometers/second

velocity vector magnitude 7.248596878485981e+00 kilometers/second

semimajor axis 8000.0000 kilometers
eccentricity 0.0265427000
orbital inclination 28.5000 degrees
argument of perigee 0.0000 degrees
RAAN 45.0000 degrees
true anomaly 360.0000 degrees

orbital period 118.6847 minutes
Back to Top View cdeagle's Profile Search for other posts by cdeagle
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 1573
Posted: 20 April 2017 at 5:58pm | IP Logged Quote matherp

Can you confirm you are using the new forced exponential format "str$(a,b,-c)" ?
Back to Top View matherp's Profile Search for other posts by matherp
 
cdeagle
Regular Member
Regular Member


Joined: 22 June 2014
Location: United States
Online Status: Offline
Posts: 92
Posted: 20 April 2017 at 6:26pm | IP Logged Quote cdeagle

Peter,

Here's the code snippet that prints the numbers.



  print "position vector x-component  ", str$(r(1), 0, -15), " kilometers"
  print "position vector y-component  ", str$(r(2), 0, -15), " kilometers"
  print "position vector z-component  ", str$(r(3), 0, -15), " kilometers"
Back to Top View cdeagle's Profile Search for other posts by cdeagle
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2018
Posted: 20 April 2017 at 9:11pm | IP Logged Quote TassyJim

The HEX of -2147483648 is FFFFFFFF80000000 so that might be a clue.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 


If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Search the forums using Google.
<< Prev Page of 6
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.0781 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.08