Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 having an uproarious good time at the Monastery: (6)
As of 2015-07-29 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls