fprintf: rationale for negative precision behavior

Mike Vermeulen mev at hpfcso.HP.COM
Fri Jun 29 03:08:54 AEST 1990


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".



More information about the Comp.std.c mailing list