Here are two seemingly contradictory quotes from the perl sprintf documentation:
Perl does its own sprintf formatting--it emulates the C function sprintf, but it doesn't use it (except for floating-point numbers, and even then only the standard modifiers are allowed). As a result, any non-standard extensions in your local sprintf are not available from Perl.
Note that the number of exponent digits in the scientific notation produced by %e , %E , %g and %G for numbers with the modulus of the exponent less than 100 is system-dependent: it may be three or less (zero-padded as necessary). In other words, 1.23 times ten to the 99th may be either "1.23e99" or "1.23e099".
So, if perl uses its own, then why can't it behave the same way on all systems?
In my perlbug report (#48881) I expressed my, uh, dissatisfaction.
I just reread the first quote and for some reason I just got glossy-eyed when I encountered the exception. I suppose for performance reasons, perl uses native libraries for some (all?) floating point operations?
In reply to sprintf and scientific notation by jholt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |