Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Answer: How do I round a number?

by I0 (Priest)
on Dec 16, 2000 at 02:38 UTC ( [id://46952]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I round a number?
in thread How do I round a number?

$rounded = int ( $orig + 0.5 ) assumes $rounded is positive.
More generally:  use POSIX; $rounded = floor ( $orig + 0.5 )
or $rounded = sprintf( "%.f" , $orig ) to properly handle the half-way case
See also `perldoc -q round`

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://46952]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found