Date: Mon, 13 Jul 1998 08:05:44 -0400 (EDT) Message-Id: <199807131205.IAA00842@delorie.com> From: DJ Delorie To: eliz AT is DOT elta DOT co DOT il CC: Kbwms AT aol DOT com, djgpp-workers AT delorie DOT com In-reply-to: (message from Eli Zaretskii on Mon, 13 Jul 1998 10:57:28 +0300 (IDT)) Subject: Re: printf "%g" format conversions Precedence: bulk > Yes. It could be argued that 0.012 is only 2 significant digits, > whereas %.3g requests for 3. Except that the ANSI spec, when talking about the f type (which the g type mimics), uses the term "fraction digits" instead of "digits of precision". I think the intent is that %.3g yields 0.012, not 0.0123 (but it would have printed 1.23E-2). However, this program: main() { double x = 0.012341234; printf("%.3e %.3f %.3g\n", x, x, x); } Yeilds: IRIX: 1.234e-02 0.012 0.0123 Linux: 1.234e-02 0.012 0.0123 SunOS4: 1.234e-02 0.012 0.0123 2.02: 1.234e-02 0.012 0.0123 So, I think we should leave it the way it is.