underflow exceptions

Joseph S. Myers joseph@codesourcery.com
Fri May 25 00:38:00 GMT 2012


On Thu, 24 May 2012, David Miller wrote:

> Failure: exp2 (-16400) == 0x1p-16400: Exception "Underflow" set

The IEEE 754 rule is that *exact* underflow cases don't raise the 
exception flag, only inexact ones, and exp2 ought to be able to handle 
exact cases properly.  exp2l is calling __scalbnl so maybe that's getting 
something wrong.

> Failure: scalbn (min_value / 4, INT_MAX) == inf: Exception "Underflow" set
> Failure: scalbln (min_value / 4, INT_MAX) == inf: Exception "Underflow" set
> Failure: scalbln (min_value / 4, LONG_MAX) == inf: Exception "Underflow" set
> Failure: scalbln (min_value / 4, 0x88000000) == inf: Exception "Underflow" set

These are all overflow cases, not underflow, and certainly should not 
raise the underflow exception.

One possibility that occurs to me is that the exception is occurring in 
the "min_value / 4" computation rather than in the function being called.  
If so, that would be a bug in soft-fp; min_value / 4 is exact so should 
not raise the underflow exception.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list