Hi, I want to get the mantissa of a number.
The problem is this:
Example --> 50/1000 = 0.050 ---> with DIV ( / ) gives me "0" , and with MOD ( % ) gives me "50" ...
so the final number displayed in the LCD is 0.50 !!
I'm using float numbers and if statements , so I can compare the float and add zeros (ASCII) but float numbers are using most of the rom and ram
what can i do to get the mantissa "with the zeros"?
thanks!
How to get the mantissa without float??
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: How to get the mantissa without float??
Hello,
I posted a v6 file here which does lots of number crunching using integer maths and then manipulates the number to print out on the LCD as if it were a floating point value.
http://www.matrixtsl.com/mmforums/viewt ... der#p61763
The Macro in question is the PrintNumWithDP which adds in a decimal point at the given position in the input number.
e.g. NumDP = 2, Number = 123, LCD output string = 1.23
You will need Flowcode 6 installed to open and view the example file but you should be able to re-create the macro in v5 without any problems.
I posted a v6 file here which does lots of number crunching using integer maths and then manipulates the number to print out on the LCD as if it were a floating point value.
http://www.matrixtsl.com/mmforums/viewt ... der#p61763
The Macro in question is the PrintNumWithDP which adds in a decimal point at the given position in the input number.
e.g. NumDP = 2, Number = 123, LCD output string = 1.23
You will need Flowcode 6 installed to open and view the example file but you should be able to re-create the macro in v5 without any problems.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel