Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Best way to round a number.

by ww (Bishop)
on Oct 25, 2012 at 01:41 UTC ( #1000745=note: print w/ replies, xml ) Need Help??


in reply to Best way to round a number.

Actually, the "best" way to round a number may be as follows:

perl -E "my $num=\"33\"; say \"$num\".'0';" 330

There appears to be some general agreement that any multiple of ten is a "round" number. If that's not a broad enough concensus, try concatenating 2, 3, 4 or 5 zeros.

This solution is scarcely more fatuous than your suggestion that the best way to round a number is "the logic on the sample code...."


Comment on Re: Best way to round a number.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2015-07-29 12:20 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 (263 votes), past polls