in reply to How to control no. of digits on exponent
As I understand things, Perl will not guarantee that the output format is what you specify. It will usually fulfill the format, and if it doesn't, it will be close.
1.23e-004 can easily be edited to fit the requirement, but if you had 1.23e-104, it can't. Editing is clunky, but it works.
There is a CPAN module which produces FORTRAN formatted strings. It will produce exactly what you want. However, it seems like it has a couple of bugs, which means it won't output everything that a FORTRAN compiled program will handle. Floating point isn't one of the problems from what I remember.
|
|---|