This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: FE_INEXACT exception question (lrint function on aarch64)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Steve Ellcey <sellcey at cavium dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Wed, 21 Jun 2017 23:23:22 +0000
- Subject: Re: FE_INEXACT exception question (lrint function on aarch64)
- Authentication-results: sourceware.org; auth=none
- References: <1498082443.31950.66.camel@cavium.com>
On Wed, 21 Jun 2017, Steve Ellcey wrote:
> I have a question about floating point exceptions and the lrint function.
> While working on ILP32 mode for aarch64 I get these glibc failures in 32 bit
> mode (but not in 64 bit mode). I believe that all of these cases are
> due to aarch64 setting the FE_INEXACT exception as well as the FE_INVALID
> exception whereas the x86 sets only the FE_INVALID exception. If we
> were converting to a 64 bit long all of these would raise only the FE_INEXACT
> exception on both the x86 and aarch64 because the resulting values fit into
> a 64 bit long.
>
> My question is: Is it wrong to set the FE_INEXACT exception as long as
> one is also setting the FE_INVALID exception? If so, what standard
> (C,C++,POSIX,IEEE) requires that we not set it.
See C11 F.10.6.5, "When they raise no other floating-point exception and
the result differs from the argument" as the condition for raising
inexact. As a fully specified function bound to IEEE 754 operations,
there should be no spurious "inexact".
--
Joseph S. Myers
joseph@codesourcery.com