To expound on BrowserUk
's post, formatting numbers/rounding numbers is usually done using sprintf
. 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.