printf "%g\n", 256123456;;
2.56123e+008
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.
| [reply] [d/l] |
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.
| [reply] [d/l] |