Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Answer: How do I round a number?

( #272801=categorized answer: print w/ replies, xml ) Need Help??

Q&A > math > How do I round a number? contributed by Mago

If you are using integers, and want to use Math::BigInt:


Math::BigInt - Arbitrary size integer math package

DESCRIPTION

All operators (inlcuding basic math operations) are overloaded if you declare your big integers as

  $i = new Math::BigInt '123_456_789_123_456_789';  

(snip)


METHODS

round

$x->round($A,$P,$round_mode); # round to accuracy or precision using + mode $r

Comment on Answer: How do I round a number?
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-09-17 05:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (60 votes), past polls