🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1451

fprintf: rationale for negative precision behavior

#1451
From: Mike Vermeulen
Date: Thu, 28 Jun 1990 17:08
28 lines
1377 bytes
I would like to know the rationale that X3J11 took for the following line
in the standard; X3.159-1989, section 4.9.6.1 fprintf, page 133, line 28:

	A negative precision argument is taken as if the precision were
	omitted.

My interpretation of this line is that the following program should print
3.141590e+00.

	#include <stdio.h>

	void main(){
	  printf("%.*e\n",-1,3.14159);
	}

X3.159-1989 differs from SVID which says (paraphrasing):

       A negative precision argument is taken as if the precision were zero.

and thus SVID would have the program above print 3e+00.  What was the rationale
for the behavior specified by X3J11?  Was the divergence with SVID known
about? intentional?  Was there a divergence in existing practice in this area?

--mev

p.s. I am not asking the religious question of "which behavior should printf
     have".  I am asking the archaeology question of "how did the standard
     come to specify the behavior for fprintf".
Technical Details
Message-ID: <7330006@hpfcso.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!usc!ucsd!ucbvax!hplabs!hpfcso!mev

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!usc!ucsd!ucbvax!hplabs!hpfcso!mev
From: mev@hpfcso.HP.COM (Mike Vermeulen)
Newsgroups: comp.std.c
Subject: fprintf: rationale for negative precision behavior
Message-ID: <7330006@hpfcso.HP.COM>
Date: 28 Jun 90 17:08:54 GMT
Organization: Hewlett-Packard, Fort Collins, CO, USA
Lines: 28