[PLUG] Perl round-up

Ed Sawicki ed at alcpress.com
Tue Aug 13 17:14:05 UTC 2002


I need to round a floating point number up to the next
integer, regardless of what the fractional part is.
Here's my first attempt:

if (int($score) != $score) {
    $score = int($score) + 1;
}

Is there a more clever way?

Ed - A Perl novice





More information about the PLUG mailing list