🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: vmsnet.alpha
Article #4

printf("%e", 0.0) prints with exponent e+01

#4
From: Craig Chamberlain
Date: Tue, 22 Dec 1992 15:20
31 lines
1156 bytes
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
-- 
(My opinions do not necessarily represent those of my employer.)
Craig Chamberlain, Software Engineer, Applicon Schlumberger
Ann Arbor, Michigan  chamber@ann-arbor.applicon.slb.com  (313) 995-6310
Technical Details
Message-ID: <1992Dec22.152013.21980@ann-arbor.applicon.slb.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!cs.utexas.edu!geraldo.cc.utexas.edu!slcs.slb.com!aa.cad.slb.com!chamber

Show Full Headers
Complete Article Headers
Newsgroups: vmsnet.alpha
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!cs.utexas.edu!geraldo.cc.utexas.edu!slcs.slb.com!aa.cad.slb.com!chamber
From: chamber@mailhost.aa.cad.slb.com (Craig Chamberlain)
Subject: printf("%e", 0.0) prints with exponent e+01
Message-ID: <1992Dec22.152013.21980@ann-arbor.applicon.slb.com>
Sender: usenet@ann-arbor.applicon.slb.com (Usenet Administrator)
Organization: Schlumberger CAD/CAM at Ann Arbor, MI
Date: Tue, 22 Dec 1992 15:20:13 GMT
Lines: 31