in reply to Re^3: Strange int() result
in thread Strange int() result
So there are two ways to look at it (numerically and as a string):
$ perl -wE '$x=35784.45; printf "%.15f\n%s", $x, $x;' 35784.449999999997090 35784.45
Since now I always assumed the string representation were made from the numerical representation thus giving the same output. That was obviously wrong.
Update:
A second counter test
reveals: the string representation always uses some rounding.$ perl -wE '$x=35784.449999999997090; printf "%.15f\n%s", $x, $x;' 35784.449999999997090 35784.45
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Strange int() result
by Laurent_R (Canon) on Jun 18, 2014 at 22:15 UTC |