[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] CR: expt should signal error on domain error

From: Jim Ursetto
Subject: Re: [Chicken-hackers] CR: expt should signal error on domain error
Date: Tue, 21 Jun 2011 13:57:44 -0500

On Jun 21, 2011, at 11:11 AM, Felix wrote:
> Then, I'm afraid, I can't follow your line of argument. This is surely
> an exceptional situation (the underflow), or not? libc's pow(3) does
> return 0.0 on underflow, therefore actually *not* indicating the error
> situation by return +NaN. What does IEEE say about this?

I posted my viewpoint on the CR separately but I wanted to chime in on this 

NaN isn't a generic error code, it just usually indicates the arguments were 
outside the function's domain (e.g. indeterminate forms, sqrt of negative).  

Underflow is different; when underflow occurs, zero is returned and an 
underflow exception is raised.  IEEE 754 specifies gradual underflow, which 
extends the range of numbers close to zero that can be represented without 
actually returning zero.  Underflow is almost always ignored, and gradual 
underflow allows nearly all underflows to be safely ignored.

To restate: underflow returns 0, but raises an informative exception.  IEEE 
knew this exception would be ignored, so designed the algorithm to make 
important underflow extremely rare.

Also, underflow is not really relevant to this CR, so, sorry for keeping it 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]