🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1517

Re: fprintf: rationale for negative precision behavior

#1517
From: Mike Vermeulen
Date: Thu, 19 Jul 1990 16:26
45 lines
2547 bytes
I received no responses to an earlier posting concerning the rationale for
fprintf behavior when given a negative precision (see also X3.159-1989, section
4.9.6.1, fprintf, page 133, line 28).  Let me try again:

Question #1.  My interpretation of X3.159-1989 is that the following program
              should print 3.141590e+00.  Do you agree with this
              interpretation?  This interpretation is different from SVID which
              expects 3e+00.

	#include <stdio.h>
	void main(){
	   printf("%.*e\n",-1,3.14159);
	}

Question #2.  When comparing the 5/13/88 draft with the 12/7/88 draft, there
        are several changes.  The standard used to say (X3J11/88-090, page 129)
-------------------------
    The precision takes the form of a period (.) followed by an optional
    decimal integer; if the integer is omitted it is treated as zero...

    A negative precision argument is taken as if were missing.
-------------------------

	The standard was changed to say (X3J11/88-159, page 133):
-------------------------
    The precision takes the form of a period (.) followed by either an asterisk
    * (described later) or by an optional decimal integer; if only the period
    is specified, the precision is taken as zero...

    A negative precision argument is taken as if the precision were omitted.
-------------------------
	If I read the 5/13/88 draft equating "missing == omitted" then it
	looks like X3J11 changed the semantics of fprintf between these two
	drafts.  Is this correct?  Did X3J11 change the behavior of fprintf
	with this edit?  If so, why, who did it and what was the rationale
	for the change?	If not, what am I missing in my interpretation of the
	5/13/88 draft?  Was this issue discussed at an X3J11 meeting?  Was the
	divergence with SVID intentional?.  Was there a divergence of existing
	practice in this area?

Question #3. If this notes group is not the correct place to ask these
	questions, who can I send them to?; particularly to understand the
	edits between 5/13/88 and 12/7/88.

--mev, mev%hpfcrt@hplabs.hpl.hp.com
Technical Details
Message-ID: <7330007@hpfcso.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpfcso!mev
References: <7330006@hpfcso.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpfcso!mev
From: mev@hpfcso.HP.COM (Mike Vermeulen)
Newsgroups: comp.std.c
Subject: Re: fprintf: rationale for negative precision behavior
Message-ID: <7330007@hpfcso.HP.COM>
Date: 19 Jul 90 16:26:18 GMT
References: <7330006@hpfcso.HP.COM>
Organization: Hewlett-Packard, Fort Collins, CO, USA
Lines: 45