Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Number digit format question

by kennethk (Abbot)
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017862]
help
Chatterbox?
and cookies bake in the oven...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2018-05-22 07:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?