[comp.std.c] fprintf: rationale for negative precision behavior

mev@hpfcso.HP.COM (Mike Vermeulen) (06/29/90)

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

mev@hpfcso.HP.COM (Mike Vermeulen) (07/19/90)

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