[6934] in Athena Bugs
rt 7.1H: Error in printf with %g (RT)
daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Tue Jan 22 10:05:14 1991
From: sethf@ATHENA.MIT.EDU
To: bugs@ATHENA.MIT.EDU
Date: Tue, 22 Jan 91 10:04:53 EST
System name: frumious-bandersnatch
Type and version: RTPC-ROMPC 7.1H
Display type: apa16
What were you trying to do?
Use %g in printf
What's wrong:
running this program
#include <stdio.h>
main() {
double x = 1e-100;
printf("%lf %le %lg\n",x,x,x);
}
gives the output
0.000000 1.000000e-100 1.e-:0
What should have happened:
1.e-:0 is right out. It's clear this was printed because ':' is
the character after '9', but the modified ASCIImal exponent system is
not commonly used. 1.000000e-100 should have been printed.
Please describe any relevant documentation references:
printf(3)