This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: underflow exceptions
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 25 May 2012 00:26:44 +0000 (UTC)
- Subject: Re: underflow exceptions
- References: <20120524.201132.1568231679386443267.davem@davemloft.net>
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