Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Simple Rounding

by PERLscienceman (Curate)
on Mar 26, 2004 at 02:50 UTC ( #339933=note: print w/ replies, xml ) Need Help??


in reply to Simple Rounding

Greetings Fellow Monk!
In the standing philosophy of "There Is Always More Than One Way To Do It" I found this CPAN module, Math::Round, which should also do what you are looking for. I have included a chunk of example/test code below:

#!/usr/bin/perl -w use strict; use Math::Round; my $number=1100.64686081907; $number=nearest(.01,$number); print "$number\n"; ___OUTPUT___ 1100.65


Comment on Re: Simple Rounding
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2015-08-04 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (62 votes), past polls