in reply to formatting text with E-XX
perl -e "$f=1.567E-09;printf qq{ '%s' is '%8.3g'$/}, $f, $f;"
'1.567e-009' is '1.57e-009'
perl -e "$f=1.567E-09;printf qq{ '%s' is '%8.3G'$/}, $f, $f;"
'1.567e-009' is '1.57E-009'
If you need to force only two digits on the exponent you might have to resort to an RE?
|
|---|