UninterpretedBytes>>doubleAt:

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

UninterpretedBytes>>doubleAt:

Dirk Verleysen

I admit that this is not my speciality but anyone has an idea why this won't work

(UninterpretedBytes from: (ByteArray fromHexString: 'FFFFFFFFFFFFFF7F')) doubleAt: 1

If I change the last 2 digits to 7E or 80 it works but not with 7F.

Dirk

Reply | Threaded
Open this post in threaded view
|

Re: UninterpretedBytes>>doubleAt:

Ralf Propach
Dirk Verleysen wrote:
> I admit that this is not my speciality but anyone has an idea why this won't work
>
> (UninterpretedBytes from: (ByteArray fromHexString: 'FFFFFFFFFFFFFF7F')) doubleAt: 1
>
> If I change the last 2 digits to 7E or 80 it works but not with 7F.
>
> Dirk
>
>
As the error message says, because this ByteArray does not represent a valid double.
Invalid doubles, e.g. NaNs and Infinities are represented with Exp being all 1s (2047).
See http://en.wikipedia.org/wiki/IEEE_floating-point_standard

Ralf

Reply | Threaded
Open this post in threaded view
|

AW: UninterpretedBytes>>doubleAt:

Georg Heeg
In reply to this post by Dirk Verleysen
Dirk,

Did you check where the bit pattern is valid for IEEE double (IEEE 754
(ANSI/IEEE Std 754-1985; IEC-60559:1989 - International version))? There are
many pattern which are not defined.

You will find details in eg in German Wikipedia

Georg

-----Ursprüngliche Nachricht-----
Von: Dirk Verleysen [mailto:[hidden email]]
Gesendet: Mittwoch, 18. Oktober 2006 15:20
An: [hidden email]
Betreff: UninterpretedBytes>>doubleAt:


I admit that this is not my speciality but anyone has an idea why this won't
work

(UninterpretedBytes from: (ByteArray fromHexString: 'FFFFFFFFFFFFFF7F'))
doubleAt: 1

If I change the last 2 digits to 7E or 80 it works but not with 7F.

Dirk


Reply | Threaded
Open this post in threaded view
|

RE: UninterpretedBytes>>doubleAt:

Dirk Verleysen
Thanks, I'll have to check what this protocol really means with this value at least if there is still a developer around :(

-----Oorspronkelijk bericht-----
Van: Georg Heeg [mailto:[hidden email]]
Verzonden: wo 18/10/2006 15:40
Aan: Dirk Verleysen; [hidden email]
Onderwerp: AW: UninterpretedBytes>>doubleAt:
 
Dirk,

Did you check where the bit pattern is valid for IEEE double (IEEE 754
(ANSI/IEEE Std 754-1985; IEC-60559:1989 - International version))? There are
many pattern which are not defined.

You will find details in eg in German Wikipedia

Georg

-----Ursprüngliche Nachricht-----
Von: Dirk Verleysen [mailto:[hidden email]]
Gesendet: Mittwoch, 18. Oktober 2006 15:20
An: [hidden email]
Betreff: UninterpretedBytes>>doubleAt:


I admit that this is not my speciality but anyone has an idea why this won't
work

(UninterpretedBytes from: (ByteArray fromHexString: 'FFFFFFFFFFFFFF7F'))
doubleAt: 1

If I change the last 2 digits to 7E or 80 it works but not with 7F.

Dirk



Reply | Threaded
Open this post in threaded view
|

Re: UninterpretedBytes>>doubleAt:

eliot-2
In reply to this post by Dirk Verleysen
Hi Dirk,


"Dirk Verleysen" <[hidden email]> wrote:

| I admit that this is not my speciality but anyone has an idea why this won't work

| (UninterpretedBytes from: (ByteArray fromHexString: 'FFFFFFFFFFFFFF7F')) doubleAt: 1

| If I change the last 2 digits to 7E or 80 it works but not with 7F.

Georg and Ral;f have correctly identified the problem.  My default VisualWorks doesn't allow NaN and Inf doubles to be created.  But you can put teh system into "IEEE" mode where it will allow these values.  See the preview/parcels/IEEEMath.pcl parcel and the vm switch
        -ieeefp
or the 'IEEEFloatingPointPrimitives' flag in Objectmemory class objectRegisteredWithEngineFor:

If ObjectStudio supports IEEE NaN and Inf in floats and doubles then OS8 shoudl consider using IEEEMath and enabling IEEEFloatingPointPrimitives by default.

Note that the IEEEFloatingPointPrimitives settng persists across snapshots, so it only needs to be set once.

HTH
---
Eliot Miranda                 ,,,^..^,,,                mailto:[hidden email]
VisualWorks Engineering, Cincom  Smalltalk: scene not herd  Tel +1 408 216 4581
3350 Scott Blvd, Bldg 36 Suite B, Santa Clara, CA 95054 USA Fax +1 408 216 4500


Reply | Threaded
Open this post in threaded view
|

AW: UninterpretedBytes>>doubleAt:

Georg Heeg
Thank you. I created AR 51346 Make IEEE Floats work correctly in
ObjectStudio 8

-----Ursprüngliche Nachricht-----
Von: [hidden email] [mailto:[hidden email]]
Gesendet: Mittwoch, 18. Oktober 2006 18:31
An: [hidden email]
Cc: [hidden email]
Betreff: Re: UninterpretedBytes>>doubleAt:

Hi Dirk,


"Dirk Verleysen" <[hidden email]> wrote:

| I admit that this is not my speciality but anyone has an idea why this
won't work

| (UninterpretedBytes from: (ByteArray fromHexString: 'FFFFFFFFFFFFFF7F'))
doubleAt: 1

| If I change the last 2 digits to 7E or 80 it works but not with 7F.

Georg and Ral;f have correctly identified the problem.  My default
VisualWorks doesn't allow NaN and Inf doubles to be created.  But you can
put teh system into "IEEE" mode where it will allow these values.  See the
preview/parcels/IEEEMath.pcl parcel and the vm switch
        -ieeefp
or the 'IEEEFloatingPointPrimitives' flag in Objectmemory class
objectRegisteredWithEngineFor:

If ObjectStudio supports IEEE NaN and Inf in floats and doubles then OS8
shoudl consider using IEEEMath and enabling IEEEFloatingPointPrimitives by
default.

Note that the IEEEFloatingPointPrimitives settng persists across snapshots,
so it only needs to be set once.

HTH
---
Eliot Miranda                 ,,,^..^,,,
mailto:[hidden email]
VisualWorks Engineering, Cincom  Smalltalk: scene not herd  Tel +1 408 216
4581
3350 Scott Blvd, Bldg 36 Suite B, Santa Clara, CA 95054 USA Fax +1 408 216
4500