in reply to Re: Using (s)printf()
in thread Using (s)printf()
- The first one (9.3333 -> 9.34) is a typo in the original.
- The second and third one are easily explained by the following
This means that due to the limitations of the internal representation, the literal 9.55 is in fact 9.550000000000001 which rounds to 9.56. The same goes for 43.55 but there the representation is slightly smaller than 43.55 so a rounding down occurs.printf("%.15f", 9.55); # prints 9.550000000000001 printf("%.15f", 43.55); # prints 43.549999999999997
-- Hofmator
In Section
Tutorials