Questions about NCEG

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Thu May 31 23:10:44 AEST 1990


In article <1990May29.193451.6533 at twinsun.com> eggert at twinsun.com (Paul Eggert) writes:
>|(3) There are special numbers (+ and - infinity, -0, NaNs, Vax reserved
>|    operands, &c) which have no standard syntax.
    [actually, I think I wrote that bit]
In article <5491 at ibmpa.UUCP>, jsalter at slo.uucp (James Salter) writes:
> Nitpick: -0 is an integer and doesn't exist.  -0.0 is a floating-point value
> and does exist.

Counter-nitpick:  the text of ANSI/IEEE Std 754-1985 consistently says -0,
not -0.0

> But IEEE 754 (Sec. 5.7) says that when comparing the two, (-0.0 == +0.0)
> so that can't be used for comparison.  The way I test this is to strip
> off the sign bit and test that.

Would it not be better to use copysign()?  (754 Appendix (1)).

By the way, someone said that -0.0 is 0.0 in C.  The Appendix *is not
binding*, but it does say "-X is X copied with its sign reversed, not 0-X;
the distinction is germane when X is +/- 0 or NaN."

> There aren't a lot of people who actually use the data that can be embedded
> in NaNs, so it's not very worrysome.

IEEE 754 says that "at least one signalling Nan" and "at least one quiet
Nan" "shall be provided".  The encoding for single and double is spelled
out and has room for more, but there is nothing to say that single
extended or double extended has more than 2 NaNs.  With reference to
hex float, the encoding of single and double extended isn't specified
either, so there is _no_ method of expressing a long double that is
covered by IEEE 754.

Of course, C also has to cater for people using /370s, Crays,
non-IEEE-conformant chips like 8087s (ask about the details in
comp.arch, I've forgotten), VAXen, PR1MEs.
-- 
"A 7th class of programs, correct in every way, is believed to exist by a
few computer scientists.  However, no example could be found to include here."



More information about the Comp.std.c mailing list