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

Re: Printing a very small number

by betterworld (Curate)
on Aug 16, 2013 at 11:37 UTC ( #1049728=note: print w/replies, xml ) Need Help??


in reply to Printing a very small number

For a precise output:

use Math::BigRat; my $num = Math::BigRat->new("9e-10"); print $num->as_float(), "\n";

Output: 0.0000000009

Replies are listed 'Best First'.
Re^2: Printing a very small number
by BrowserUk (Pope) on Aug 16, 2013 at 12:20 UTC
    For a precise output:

    That works if your small number starts out as a string, but if it comes from a calculation done using normal Perl math, the 'damage' has already been done.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1049728]
help
Chatterbox?
[Discipulus]: New Zeland and Italy share a simila faith!
[Discipulus]: same shape, earthquakes and premier dimissions the same day

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2016-12-05 11:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (80 votes). Check out past polls.