www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/02/02:52:23

Date: Mon, 2 Mar 1998 09:51:38 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Erik Max Francis <max AT alcyone DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: printf 'g' conversion
In-Reply-To: <34FA0CD5.79608BBD@alcyone.com>
Message-ID: <Pine.SUN.3.91.980302095120.15685J-100000@is>
MIME-Version: 1.0

On Sun, 1 Mar 1998, Erik Max Francis wrote:

> Why not look at the _actual_ ANSI document?  From ANSI 7.9.6.1:
> 
>     The double argument is converted in style f or e (or in style E in
>     the case of a G conversion specifier), with the precision specifying
>     the number of significant digits.  If the precision is zero, it is
>     taken as 1.

Sorry, I must be too dense today ;-).  I *did* read the Standard
before posting.  It says (in a fragment you didn't quote) that when
the `e' style would result in a sufficiently small exponent, `f' style
should be used.  This is all okay, and DJGPP's libc does just that: it
prints a number like if you said "%11.9f".

What is unclear to me is whether using %11.9f for %9.9g is correct
when the former produces leading zeros, like in "0.012345679", since
these leading zeos are not, strictly speaking, significant digits.  I
couldn't see anything in the Standard that clarifies this.  Can you?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019