IEEE 64 Bit and Float>>asIEEE32BitWord

Eric Arseneau eat at huv.com
Mon May 29 03:10:58 UTC 2000


> Then have a look at
>
> 	Float class>>fromIEEE32BitWord:
>
> It takes an unsigned 32bit integer representing the bit pattern
> for a 32bit
> float value and returns an instance of class Float (that is a
> 64bit value).
> In other words:
> 	Float asIEEE32BitWord
> 		64bit -> 32bit
> 	Float class fromIEEE32BitWord:
> 		32bit -> 64bit
> Hope this helps,

It does help, as it shows my STUPIDITY !!!  I just took a closer look at the
code and realized that Float is a variable WORD subclass, I did not know
such a thing existed.  When you look at

<...>
	self = 0.0 ifTrue:[^0].
	word1 _ self basicAt: 1.
	word2 _ self basicAt: 2.
<...>

I just looked at the basicAt: op, and assumed that it returned a byte.
Which in hindsight was stupid to start with, as the vars the result is being
assigned to are word1 & 2.

So the implementation of Float is already an IEEE Double and I just didn't
have the good sense to notice it.

Thank you very much for the help





More information about the Squeak-dev mailing list