Pages: [1]   Go Down
Author Topic: most significant digits on calculation  (Read 372 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: