> I think Float>>#asIEEE32BitWord is bugged for NaNs. Why?
> Float nan asIEEE32BitWord printPaddedWith: $0 to: 32 base: 2
> yields: '01111111100000000000000000000000'
> which is excately the same as
> Float infinity asIEEE32BitWord printPaddedWith: $0 to: 32 base: 2
>
> so basically
> sign: 0
> exponent: 255
> mantissa: 0
>
> According to the class comment of Float and Google this is the correct
> representation of positive inifinity. A NaN would have a non-zero
> mantissa.
>
> I think the bug is:
> exponent > 254 ifTrue:["Overflow"
> exponent := 255.
> mantissa := 0].
> this should be:
> exponent > 254 ifTrue:["Overflow"
> exponent := 255.
> self isNaN ifFalse: [
> mantissa := 0 ] ].
>
> Does this make any sense?
Well of course this wasn't the only bug.
Float fromIEEE32Bit: 16r80000000 returns 0.0 instead of Float negativeZero
Float negativeZero asIEEE32BitWord returns 0 instead of 16r80000000.
Philippe