Mail Archives: djgpp-workers/2000/03/22/09:38:54
On 22 Mar 00, Eli Zaretskii wrote:
> On Tue, 21 Mar 2000 ams AT ludd DOT luth DOT se wrote:
>
> > The copysign functions produce a value with the magnitude of x and
> > the sign of y. They produce a NaN (with the sign of y) if x is a
> > NaN."
> >
> > This means the standard do think that NaNs have a sign (however
> > misguided that is)
>
> No, they only think a NaN *might* have a sign. If there's no notion
> of a sign of a NaN, the copying a sign to it does nothing.
I think there speaks nothing against the interpretation of the sign
bit. There was an interesting post in comp.std.c from Nick MacLaren.
I show the relevant parts here:
[...]
> IEEE 754 6.3 starts by saying "This standard does not interpret
> the sign of a NaN."
>
> The informative appendix is the source of the confusion. It says:
>
> (1) Copysign(x,y) returns x with the sign of y. Hence
> abs(x) = copysign(x,1.0), even if x is a NaN.
> (2) -x is x copied with its sign reversed, not 0-x; the
> distinction is germane when x ia +-0 or a NaN.
[...]
> Now, neither IEEE 754 nor C90 state explicitly what should be
> done when the second argument to copysign is a NaN, but C90
[I think, he meant C99, but I could be wrong]
> does include enough to make it clear that the intent is that
> copysign(1.0,x) returns the 'sign' of a NaN and thus the
> macro signbit is expected to expand into that. For example:
[...]
The message-ID of the post is <8b7sls$bqv$1 AT pegasus DOT csx DOT cam DOT ac DOT uk>
Regards,
Dieter
- Raw text -