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

Jason Elbaum Jason.Elbaum at freescale.com
Thu May 6 05:38:27 PDT 2004

Zohar Kelrich wrote:

$f < int $f+.5 ? int $f+1 : int $f

This code snippet is just the conventional round() function. It can be 
written more simply as:

int($x + 0.5)

Jason Elbaum
Freescale Semiconductor

More information about the Perl mailing list