Go Down

Topic: most significant digits on calculation (Read 383 times) previous topic - next topic

kyrpav

How can i set the most significant digits in calculation with arduino. Lets say i want to get result of a float after the maths with 8decimal. i think that the point is at serial.print with float or double. what ensures me that i do not loose accuracy with every calculation?

dxw00d

http://arduino.cc/en/Serial/Print

Quote
An optional second parameter specifies the base (format) to use; permitted values are BIN (binary, or base 2), OCT (octal, or base 8), DEC (decimal, or base 10), HEX (hexadecimal, or base 16). For floating point numbers, this parameter specifies the number of decimal places to use.


But note that: http://arduino.cc/en/Reference/Float

Quote
Floats have only 6-7 decimal digits of precision. That means the total number of digits, not the number to the right of the decimal point. Unlike other platforms, where you can get more precision by using a double (e.g. up to 15 digits), on the Arduino, double is the same size as float.

Go Up