signaling NaN

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

signaling NaN

otto
Hi,

We would like exceptions to be raised for division by zero and the
like. If I understand it correctly, it's possible to get GS to throw
exceptions and not return NaN floats. Is this correct? How would I do
this?

Thanks
Otto
Reply | Threaded
Open this post in threaded view
|

Re: signaling NaN

Dale Henrichs
Otto there is a bug report on this issue (Bug33840) and this is a snippet from the bug report:

-------------------
DecimalFloat clearAllExceptions.
DecimalFloat raisedException: #invalidOperation. "false; as expected"
(0.0f0 * DecimalPlusInfinity) printString.
DecimalFloat raisedException: #invalidOperation. "true; as expected"

DecimalFloat raisedException: #divideByZero. "false; as expected"
(1.0f0 / 0.0f0) printString.
DecimalFloat raisedException: #divideByZero. "true; as expected"

Float clearAllExceptions.
Float raisedException: #invalidOperation. "false; as expected"
(0.0f0 * PlusInfinity) printString.
Float raisedException: #invalidOperation. "false; should be true"

Float raisedException: #divideByZero. "false; as expected"
(1.0e0 _asFloat / 00.0e0) printString.
Float raisedException: #divideByZero. "false; should be true"
---------------------------

So it looks like, you can try to enable the exceptions, but you won't get the correct/expected behavior. So far the bug has been deferred.

Dale

----- Original Message -----

> Hi,
>
> We would like exceptions to be raised for division by zero and the
> like. If I understand it correctly, it's possible to get GS to throw
> exceptions and not return NaN floats. Is this correct? How would I do
> this?
>
> Thanks
> Otto
>
Reply | Threaded
Open this post in threaded view
|

Re: signalling NaN

Ivan, Liliana
Hi Dale.

Can you say - deferred for how long? We're still busy with the RMB conversion and the expected behaviour of the trading system is to get an exception when dividing a float by zero.

Thanks
Liliana

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Dale Henrichs
Sent: 01 June 2011 02:12
To: GemStone Seaside beta discussion
Subject: Re: [GS/SS Beta] signaling NaN

Otto there is a bug report on this issue (Bug33840) and this is a snippet from the bug report:

-------------------
DecimalFloat clearAllExceptions.
DecimalFloat raisedException: #invalidOperation. "false; as expected"
(0.0f0 * DecimalPlusInfinity) printString.
DecimalFloat raisedException: #invalidOperation. "true; as expected"

DecimalFloat raisedException: #divideByZero. "false; as expected"
(1.0f0 / 0.0f0) printString.
DecimalFloat raisedException: #divideByZero. "true; as expected"

Float clearAllExceptions.
Float raisedException: #invalidOperation. "false; as expected"
(0.0f0 * PlusInfinity) printString.
Float raisedException: #invalidOperation. "false; should be true"

Float raisedException: #divideByZero. "false; as expected"
(1.0e0 _asFloat / 00.0e0) printString.
Float raisedException: #divideByZero. "false; should be true"
---------------------------

So it looks like, you can try to enable the exceptions, but you won't get the correct/expected behavior. So far the bug has been deferred.

Dale

----- Original Message -----

> Hi,
>
> We would like exceptions to be raised for division by zero and the
> like. If I understand it correctly, it's possible to get GS to throw
> exceptions and not return NaN floats. Is this correct? How would I do
> this?
>
> Thanks
> Otto
>

This e-mail is subject to a disclaimer, available at http://www.rmb.co.za/web/elements.nsf/online/disclaimer-communications.html
Reply | Threaded
Open this post in threaded view
|

Re: signaling NaN

otto
In reply to this post by Dale Henrichs
Thanks, Dale

> So it looks like, you can try to enable the exceptions, but you won't get the correct/expected behavior. So far the bug has been deferred.

How do I enable the exceptions?

I would like to try it out with DecimalFloat, which seems to work
according to your examples.

Thanks
Otto