go ahead... be a heretic | |
PerlMonks |
Re: NV/IV Bug ?by Steve_p (Priest) |
on Feb 27, 2003 at 19:18 UTC ( [id://239211]=note: print w/replies, xml ) | Need Help?? |
int() always rounds down. In cases where you are working with floating-points, the precision may not be what you expect. So, to paraphase perldoc -f int, your 395 and 115 may look more like 394.99999943242 or 114.999999523523. In either case, the decimal portion is truncated off. Instead, sprintf, printf, POSIX::floor, or POSIX::ceil may be better options for what you want to do.
In Section
Seekers of Perl Wisdom
|
|