[Cfp-interest 2846] Re: The leading (or negative field) bit on a NaN
Steve (Swift) Canon
scanon at apple.com
Thu Aug 24 08:26:20 PDT 2023
This is one of the dustier corners of 754; the relevant part of the standard is:
> When either an input or result is NaN, this standard does not interpret the sign of a NaN. Note, however, that operations on bit strings — copy, negate, abs, copySign — specify the sign bit of a NaN result, sometimes based upon the sign bit of a NaN operand.
So NaN has a signbit in the encoding, but it is not a sign, but it behaves as though it were a sign for the purposes of the copySign operation.
Note that the signbit is explicitly _not_ part of a NaN’s payload, even though Mike finds it convenient to work with them this way:
Binary formats:
> The remaining bits, which are in the trailing significand field, encode the payload, which might be diagnostic information (see above).
Decimal:
> The remaining bits of G are ignored, and T constitutes the NaN’s payload, which can be used to distinguish various NaNs.
– Steve
> On Aug 24, 2023, at 10:43 AM, Mike Cowlishaw <mfc at speleotrove.com> wrote:
>
> I would say that's a question to ask on the 754 list, not here :-). By
> definition NaNs are not numbers so do not have a sign. I just find it
> convenient to think of the NaN's payload as having a sign -- which is not
> suggesting that the NaN has a sign.
>
> Mike
>
>> -----Original Message-----
>> On Thu, 24 Aug 2023, Mike Cowlishaw wrote:
>>
>>> Technically its 'just another bit'. However, in my
>>> testcases I treat
>>> the payload of the NaN as being a signed integer having the
>>> value of
>>> the significand and signed by treating that bit as a sign
>>> bit. This
>>> to me, is useful and unambiguous, and it also works for
>>> both decimal
>>> significand codings..
>>
>> I was looking at in the context of the projection of a complex number
>>
>> x + I y
>>
>> onto the eextended complex plane (as modelled by a Riemann
>> sphere) of a complex number with an infinite part. This is
>> the 'cproj' routine.
>>
>> It returns
>>
>> INFINOYI + I (+|-0.0)
>>
>> where the sign of that zero is directly affected by the sign of 'y'.
>>
>> However, I cannot see how, if 'y' is a NaN, that its payload
>> details, specifically the 'sign' bit, should influence the
>> sign of that 0.0.
>>
>> Just curious.
>>
>> Or is the reason definitional to provide reproducible results?
>>
>> Thanks - Damian
>>
>
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
More information about the Cfp-interest
mailing list