|Keep It Simple, Stupid|
Re: int() function (updated)by LanX (Cardinal)
|on Oct 24, 2020 at 11:31 UTC||Need Help??|
Perl does an internal magic error correction/guessing when printing a number like 195.999999...etc to compensate rounding errors on the last digits. (This of course in binary and not decimal representation)
I think that's why it prints $x1 as 196.
I'll check as soon my laptop is up and running.
as I thought, it's compensating the rounding error from not being able to accurately represent 0.15 in a based 2 floating number:
There is an easy workaround , avoid the decimal point when calculating and divide at the very end.
see also Humans have too many fingers