Questions about NCEG

Paul Eggert eggert at twinsun.com
Fri Jun 1 08:34:36 AEST 1990


Doug Gwyn writes:

	... the IEEE 754 "user" can be taken as the C implementation.  There is
	no requirement that the "user" actually exploit all the features that
	IEEE 754 requires be made available to the "user".

To conform to IEEE 754, an ANSI C implementation can't merely use IEEE 754
internally.  It must make IEEE 754 available to its users, namely to the
programs that it accepts.  If a company advertised that its C implementation
conformed to both ANSI C and IEEE 754, and its customers complained about IEEE
754 features that were missing, could it get away with telling them that their
programs weren't the real ``users'' of IEEE 754?

	[IEEE 754] does not require that writing "-0.0" in C source code be a
	way of producing a "minus zero".

True, but only because neither standard talks about each other, so an
implementation that conforms to both ANSI C and IEEE 754 can combine them
perversely.  For example, a perverse implementer could say ``to use IEEE 754,
one must use the types like _ieee_754_double_format, and invoke functions like
_ieee_754_double_negate(x)''.  But in a normal implementation, one would expect
the ANSI C types float and double to stand for IEEE 754 single format and
double format, and the ANSI C unary floating `-' operator to stand for the IEEE
754 `-x' function.  In such an implementation, -0.0 must evaluate to minus
zero.

	Mathematically it is nonsense to say -0 is not identical to 0.

I also dislike some of IEEE 754's provisions.  But that's not the issue here.


Granted, no standard specifies the relationship between IEEE 754 and ANSI C,
and what I think is ``perverse'' is only my opinion; but surely most users
would agree with the ``normal'' implementation described above.  However, if we
don't all agree on this question, shouldn't it be addressed by NCEG?

While we're on the subject, NCEG should provide for a way for a program to
print a number so that it can be read back.  ANSI C's "C" locale requires that
an IEEE 754 implementation's scanf() cannot read some numbers that its printf()
should be able to output, namely infinities and NaNs.  This is unfortunate: it
should be easy for a program to scan numbers that it prints.  How can I forward
comments like this to the NCEG committee?



More information about the Comp.std.c mailing list