in reply to Re: Rounding off numbers
in thread Rounding off numbers
results in the decimal part of the number simply being truncated, giving an integer value with the above example of 2, not 3, which is possibly not what's expected.my $float = 2.744; my $int = int $float;
Update: Although, of course, adding the 0.5 to the number solves the problem nicely. Didn't see that in the post until just now ..
-- Tanalis
#include www.liquidfusion.org.uk
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Rounding off numbers
by sgifford (Prior) on Apr 20, 2006 at 14:37 UTC |