|Keep It Simple, Stupid|
int() functionby geoperl (Novice)
|on Oct 24, 2020 at 10:45 UTC||Need Help??|
geoperl has asked for the wisdom of the Perl Monks concerning the following question:
I came across with a strange result when I'm using int() function. For example,
It prints "Number is: 196, Integer part is: 195", but I would expect $x2 to be 196
But when I am using different numbers I am getting the correct results. For example,
Can anybody guess what goes wrong with the first one, what goes wrong when I'm using the number 170? At least, I would expect either all results be correct or all results be wrong, but not just one be wrong.
Using int(sprintf("%.2f",$x1)) fixes the error but this is not the issue.