COG-VM Float endianness problems

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

COG-VM Float endianness problems

Nicolas Cellier
Hi,
I'm using windows COG VM + image provided by Andreas.
I note a few problems related to the change of endianness of Float.

One of it is Float negativeZero sign = 1, instead of -1.

Float>>sign
        "Answer 1 if the receiver is greater than 0, -1 if less than 0, else 0.
        Handle IEEE-754 negative-zero by reporting a sign of -1"

        self > 0 ifTrue: [^ 1].
        (self < 0 or: [((self at: 1) bitShift: -31) = 1]) ifTrue: [^ -1].
        ^ 0

Does the image miss a few changes ?

Nicolas

Reply | Threaded
Open this post in threaded view
|

Re: COG-VM Float endianness problems

Eliot Miranda-2


On Mon, Jun 21, 2010 at 10:46 AM, Nicolas Cellier <[hidden email]> wrote:
Hi,
I'm using windows COG VM + image provided by Andreas.
I note a few problems related to the change of endianness of Float.

One of it is Float negativeZero sign = 1, instead of -1.

Float>>sign
       "Answer 1 if the receiver is greater than 0, -1 if less than 0, else 0.
       Handle IEEE-754 negative-zero by reporting a sign of -1"

       self > 0 ifTrue: [^ 1].
       (self < 0 or: [((self at: 1) bitShift: -31) = 1]) ifTrue: [^ -1].
       ^ 0

Does the image miss a few changes ?

Looks like it.  In my image I get -1 as expected.  make sure you've filed in NecessaryImageChangesForCogToWork.1.cs or updated to latest trunk.

The underlying issue is that because Cog holds floats in platform order internally one has to use special versions of Float at: basicAt: at:put: and basicAt:put: that hide the reordering from Squeak.  These are in NecessaryImageChangesForCogToWork.1.cs and latest trunk.

cheers,
Eliot


Nicolas




Reply | Threaded
Open this post in threaded view
|

Re: COG-VM Float endianness problems

Nicolas Cellier
2010/6/21 Eliot Miranda <[hidden email]>:

>
>
> On Mon, Jun 21, 2010 at 10:46 AM, Nicolas Cellier
> <[hidden email]> wrote:
>>
>> Hi,
>> I'm using windows COG VM + image provided by Andreas.
>> I note a few problems related to the change of endianness of Float.
>>
>> One of it is Float negativeZero sign = 1, instead of -1.
>>
>> Float>>sign
>>        "Answer 1 if the receiver is greater than 0, -1 if less than 0,
>> else 0.
>>        Handle IEEE-754 negative-zero by reporting a sign of -1"
>>
>>        self > 0 ifTrue: [^ 1].
>>        (self < 0 or: [((self at: 1) bitShift: -31) = 1]) ifTrue: [^ -1].
>>        ^ 0
>>
>> Does the image miss a few changes ?
>
> Looks like it.  In my image I get -1 as expected.  make sure you've filed in
> NecessaryImageChangesForCogToWork.1.cs or updated to latest trunk.
> The underlying issue is that because Cog holds floats in platform order
> internally one has to use special versions of Float at: basicAt: at:put: and
> basicAt:put: that hide the reordering from Squeak.  These are
> in NecessaryImageChangesForCogToWork.1.cs and latest trunk.
> cheers,
> Eliot

OK, thanks, the Float at: at:put: basicAt: basicAt:put: are not in
Andreas image and must be filed in indeed.

Nicolas

>>
>> Nicolas
>>
>
>
>
>
>