Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Number digit format question

by kennethk (Monsignor)
on Feb 08, 2013 at 17:02 UTC ( #1017862=note: print w/ replies, xml ) Need Help??


in reply to Number digit format question

To expound on BrowserUk's post, formatting numbers/rounding numbers is usually done using sprintf and printf. For these routines, the details of the output, such as number of zeroes in the exponent, are controlled by the underlying C libraries on your system and are thus platform dependent. If you well and truly want the string literal above, you'll likely need to decompose the number yourself, and use sprintf to format the coefficient and interpolate it all together, e.g. sprintf "%.2fE%+2.2d", $coef, $exp.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: Number digit format question
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2014-09-19 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (129 votes), past polls