in reply to finding the correct integer
Obligatory link to What Every Programmer Should Know About Floating-Point Arithmetic and reference to bignum iff you don't mind the performance hit.
$ perl -wMstrict -Mbignum -le 'print int(0.6505 / 0.0001)' 6505 # Or, limit the scope of the pragma: $ perl -wMstrict -le 'print do { use bignum; int(0.6505 / 0.0001) }' 6505
|
---|