in reply to perl floating number addition
For example
$ perl -e '$a+=0.1 for 1..10; print $a - 1' -1.11022302462516e-16
See also PerlFAQ4 - Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)?
Update: Added example code
Update^2: Eventually found the FAQ
|
---|