in reply to Round down to '.5' or '.0'
sub round_to_halves { return 0.5 * (int(2*$_[0])); } my $num = 1.6; print round_to_halves($num), "\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Round down to '.5' or '.0'
by gamache (Friar) on Oct 24, 2007 at 18:43 UTC |