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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Using (s)printf()
by Anonymous Monk on Sep 01, 2001 at 07:29 UTC | |
by Hofmator (Curate) on Sep 03, 2001 at 15:32 UTC | |
Re: Re: Re: Using (s)printf()
by Zteven (Initiate) on Sep 02, 2001 at 15:08 UTC | |
by Iphigenie (Initiate) on Oct 09, 2001 at 14:39 UTC |
In Section
Tutorials