delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/01/19/14:00:37

Date: Tue, 19 Jan 1999 14:00:02 -0500 (EST)
From: Stephen L Moshier <moshier AT mediaone DOT net>
X-Sender: moshier AT moshier DOT ne DOT mediaone DOT net
To: Kbwms AT aol DOT com
cc: Robert Hoehne <robert DOT hoehne AT gmx DOT net>, djgpp-workers AT delorie DOT com
Subject: Re: Bug when printing long doubles
In-Reply-To: <58ca22ce.36a4c038@aol.com>
Message-ID: <Pine.LNX.4.05.9901191347400.16956-100000@moshier.ne.mediaone.net>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com


On Tue, 19 Jan 1999 Kbwms AT aol DOT com wrote:
> Are there any words in any of the Standards that provide guidance here?


Here is some jailhouse lawyer reading from C9X:

      7.19.6.1  The fprintf function
...
       f,F     A  double argument representing a (finite) floating- |
               point number is converted to decimal notation in the
               style  [-]ddd.ddd,  where the number of digits after
               the  decimal-point  character  is   equal   to   the
               precision   specification.    If  the  precision  is
               missing, it is taken as 6; if the precision is  zero
               and  the  #  flag is not specified, no decimal-point
               character appears.   If  a  decimal-point  character
               appears,  at least one digit appears before it.  The
               value  is  rounded  to  the  appropriate  number  of
               digits.

               A   double  argument  representing  an  infinity  is
               converted in one of the styles [-]inf or [-]infinity
                --    which  style  is  implementation-defined.   A
               double argument representing a NaN is  converted  in
               one of the styles [-]nan or [-]nan(n-char-sequence)
                --   which  style,  and  the meaning of any n-char-
               sequence,   is   implementation-defined.    The    F
               conversion  specifier produces INF, INFINITY, or NAN
               instead of inf, infinity, or nan, respectively.218)

       e,E     ...
               A double argument representing an infinity or NaN is
               converted  in  the  style  of  an  f or F conversion
               specifier.

       g,G     ...
               A double argument representing an infinity or NaN is
               converted  in  the  style  of  an  f or F conversion
               specifier.
       ____________________
       218When applied to infinite and NaN values, the  -,  +,  and
          space flag characters have their usual meaning; the # and
          0 flag characters have no effect.


This footnote appears under para 7.20.1.3, strtod, strotof, strtold:
       ____________________

       233An  implementation  may  use   the   n-char-sequence   to
          determine  extra  information  to  be  represented in the
          NaN's significand.

- Raw text -


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