[Israel.pm] Rounding numbers to the nearest quarter???

Yuval Yaari yuval at windax.com
Thu May 6 05:28:30 PDT 2004


I like your solution :)
I chose Math::Round (nearest function) for this specific problem.
But I was looking for these kind of things...

Thanks,
  --Yuval

Jason Elbaum wrote:

> Multiply by four, round to nearest integer, divide by four:
>
> x=2.70
> x*4 = 10.80
> round(x*4) = 11
> round(x*4)/4 = 2.75





More information about the Perl mailing list