Display formatting help needed
Let's say I have a statement in my code:
For conversations sake lets say the variable happens to be 36348. On the display it reads 36348 but I would like the variable to read 3.6348. How do you go about formatting (?) the variable to include a decimal point and maintain the 4 decimal places?
Thanks in advance.
Don
term.dec(variable)
For conversations sake lets say the variable happens to be 36348. On the display it reads 36348 but I would like the variable to read 3.6348. How do you go about formatting (?) the variable to include a decimal point and maintain the 4 decimal places?
Thanks in advance.
Don
Comments
digit := variable / 10000
fraction := variable // 10000
Then output:
term.dec(digit)
term.tx('.')
term.dec(fraction)
If I remember right there was a trick for the rest of a division. Directly after the division you can use an internal variable to access the rest, so there is no need for a second division. Maybe someone else can jump in and confirm or reject this?!
Have some if statements, which output the right number of zeros before output of fraction.
Try or something similar.
http://obex.parallax.com/objects/search/?q=decimal+place&csrfmiddlewaretoken=ee6f6d6ce953648986730609c3fa7a4f
result |= d =< digits
to