Article View: vmsnet.alpha
Article #6Re: printf("%e", 0.0) prints with exponent e+01
From: Carl Fogelin
Date: Tue, 22 Dec 1992 17:54
Date: Tue, 22 Dec 1992 17:54
39 lines
1462 bytes
1462 bytes
In article 21980@ann-arbor.applicon.slb.com, chamber@mailhost.aa.cad.slb.com (Craig Chamberlain) writes:
>Why does the floating value 0.0 print with an exponent
>of +01 in printf %e format? It is printed as 0.000000e+00
>on the DECstation and VAX.
>
>/* printf_zero.c */
>
>#include <stdio.h>
>
>
>int
>main (argc, argv)
>int argc;
>char *argv [];
>
>{
> double dr1;
>
>
> dr1 = 0.0;
> printf("dr1 is %e %f %g\n", dr1, dr1, dr1);
>
>} /* main */
>
>$ cc/standard=vaxc/float=ieee_float printf_zero.c
>$ link printf_zero
>$ r printf_zero
>dr1 is 0.000000e+01 0.000000 0
>--
Now that's bizarre. I looked up the fprintf's "e" format in the ANSI standard
and it states:
4.9.6.1 "... If the value is zero, the exponent is zero."
I think you need an answer from DEC.
Carl C. Fogelin "This is strictly my own opinion."
(fogelinc@cyanamid.com)
Technical Details
Message-ID:
<1992Dec22.175403.10952@tigger.jvnc.net>Path:
arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!jvnc.net!nmr1!fogelincReferences:
<1992Dec22.152013.21980@ann-arbor.applicon.slb.com>Show Full Headers
Complete Article Headers
Newsgroups: vmsnet.alpha
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!jvnc.net!nmr1!fogelinc
From: fogelinc@nmr1.Cyanamid.COM (Carl Fogelin)
Subject: Re: printf("%e", 0.0) prints with exponent e+01
Message-ID: <1992Dec22.175403.10952@tigger.jvnc.net>
Sender: news@tigger.jvnc.net (Zee News Genie)
Nntp-Posting-Host: nmr1.pt.cyanamid.com
Reply-To: fogelinc@nmr1.Cyanamid.COM
Organization: American Cyanamid Company
References: <1992Dec22.152013.21980@ann-arbor.applicon.slb.com>
Date: Tue, 22 Dec 1992 17:54:03 GMT
Lines: 44