FE_INEXACT exception question (lrint function on aarch64)

Steve Ellcey sellcey@cavium.com
Wed Jun 21 22:01:00 GMT 2017


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.

Steve Ellcey
sellcey@cavium.com

% more obj/glibc32/math/test-double-finite-lrint.out
testing double (finite-math-only)
Failure: lrint (0x7fffffff.8p0): Exception "Inexact" set
Failure: lrint (0x7fffffff.cp0): Exception "Inexact" set
Failure: lrint (-0x80000000.cp0): Exception "Inexact" set
Failure: lrint_downward (-0x80000000.4p0): Exception "Inexact" set
Failure: lrint_downward (-0x80000000.7ffff8p0): Exception "Inexact" set
Failure: lrint_downward (-0x80000000.8p0): Exception "Inexact" set
Failure: lrint_downward (-0x80000000.cp0): Exception "Inexact" set
Failure: lrint_upward (0x7fffffff.4p0): Exception "Inexact" set
Failure: lrint_upward (0x7fffffff.7ffffcp0): Exception "Inexact" set
Failure: lrint_upward (0x7fffffff.8p0): Exception "Inexact" set
Failure: lrint_upward (0x7fffffff.cp0): Exception "Inexact" set

% more obj/glibc32/math/test-double-lrint.out
testing double (without inline functions)
Failure: lrint (0x7fffffff.8p0): Exception "Inexact" set
Failure: lrint (0x7fffffff.cp0): Exception "Inexact" set
Failure: lrint (-0x80000000.cp0): Exception "Inexact" set
Failure: lrint_downward (-0x80000000.4p0): Exception "Inexact" set
Failure: lrint_downward (-0x80000000.7ffff8p0): Exception "Inexact" set
Failure: lrint_downward (-0x80000000.8p0): Exception "Inexact" set
Failure: lrint_downward (-0x80000000.cp0): Exception "Inexact" set
Failure: lrint_upward (0x7fffffff.4p0): Exception "Inexact" set
Failure: lrint_upward (0x7fffffff.7ffffcp0): Exception "Inexact" set
Failure: lrint_upward (0x7fffffff.8p0): Exception "Inexact" set
Failure: lrint_upward (0x7fffffff.cp0): Exception "Inexact" set



More information about the Libc-alpha mailing list