%g format in printf
Roland McGrath
mcgrath at saffron.Berkeley.EDU
Wed Sep 6 10:53:35 AEST 1989
In article <1439 at hiatus.dec.com> daniels at grue.dec.com (Bradford R. Daniels) writes:
What should the default number of significant digits be for the
%g format specifier in printf? The standard says that an explicit
0 should be treated as a 1, but doesn't say anything about what to
do if no precision is specified.
Right now, the VAX C RTL uses 6 as the default precision. This
seems reasonable, since 6 is the default precision for the %e
and %f specifiers. However, precision has a different meaning
with %g than with those other specifiers. Is VAXCRTL's current
behavior correct?
Yes. The ANSI standard does specify that the default precision is 6.
--
Roland McGrath
Free Software Foundation, Inc.
roland at ai.mit.edu, uunet!ai.mit.edu!roland
More information about the Comp.std.c
mailing list