Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ames!pasteur!saffron!mcgrath From: mcgrath@saffron.Berkeley.EDU (Roland McGrath) Newsgroups: comp.std.c Subject: Re: %g format in printf Message-ID:Date: 6 Sep 89 00:53:35 GMT References: <1439@hiatus.dec.com> Sender: news@pasteur.Berkeley.EDU Organization: Hackers Anonymous International, Ltd., Inc. (Applications welcome) Lines: 18 In-reply-to: daniels@grue.dec.com's message of 5 Sep 89 23:19:47 GMT In article <1439@hiatus.dec.com> daniels@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@ai.mit.edu, uunet!ai.mit.edu!roland