I have a Float Value i.e. 33.00.
How can i convert it to this String 03300?
Float 33.00 --> String 03300
Float 33.10 --> String 03310
Float 33.01 --> String 03301
Float 333.01 --> String 33301
Float 980.00 --> String 98000
the zeros after the dot are very important.
use modf() to split your number into fractional and integer parts. Then multiply up your fractional part and cast to an int, liewise cast your integer part. Then use sprintf() to format your new string, can specify padding for your zeroes with the specifiers in the format string.
Multiply the number by 100 then take the integer part?
Hahaha ignore my sledgehammer nut scenario and listen to Nick.
When time you operate on a float, there’s a good chance to introduce a low order error.
There is no FPU on AVR’s. Float math is incredibly slow (compared to integer) for that reason.
The smart thing on Arduinos is to never use floating point in the first place.
If you have a device that sends floating point data over a serial line, don’t turn it into a float.
if you are dealing with fractional meters down to millimeters, do the work in micrometers and let those 3 extra places protect you from round-off errors. When you need to print out, have your software print the decimal point in where it belongs.