Skip to content

Commit ac98490

Browse files
authored
Merge pull request #864 from Core-l/patch-1
Strange results in floating point
2 parents f0431be + d74e42b commit ac98490

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: Language/Variables/Data Types/float.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ If doing math with floats, you need to add a decimal point, otherwise it will be
6767

6868
The float data type has 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.
6969

70-
Floating point numbers are not exact, and may yield strange results when compared. For example 6.0 / 3.0 may not equal 2.0. You should instead check that the absolute value of the difference between the numbers is less than some small number.
70+
Floating point numbers are not exact, and may yield strange results when compared. For example 9.0 / 0.3 may not quite equal 30.0. You should instead check that the absolute value of the difference between the numbers is less than some small number.
7171

7272
Conversion from floating point to integer math results in truncation:
7373
[source,arduino]

0 commit comments

Comments
 (0)