summaryrefslogtreecommitdiff
path: root/math/test-nearbyint-except.c
AgeCommit message (Collapse)Author
2018-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
* All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
2017-06-28Remove NO_LONG_DOUBLE conditionals in libm tests (bug 21607).Joseph Myers
As noted in bug 21607, NO_LONG_DOUBLE conditionals in libm tests are no longer effective. For most this is harmless - they were only present because of long double functions not being declared with _LIBC defined, and _LIBC is no longer defined for building most tests. For the few where this is actually relevant to the test, testing LDBL_MANT_DIG > DBL_MANT_DIG is more appropriate as that limits the test to public APIs. This patch fixes the tests accordingly. Tested for x86_64 and arm. [BZ #21607] * math/basic-test.c [!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG > DBL_MANT_DIG]. * math/bug-nextafter.c [!NO_LONG_DOUBLE]: Remove conditionals. * math/bug-nexttoward.c [!NO_LONG_DOUBLE]: Likewise. * math/test-math-isinff.cc [!NO_LONG_DOUBLE]: Likewise. * math/test-math-iszero.cc [!NO_LONG_DOUBLE]: Likewise. * math/test-nan-overflow.c [!NO_LONG_DOUBLE]: Likewise. * math/test-nan-payload.c [!NO_LONG_DOUBLE]: Likewise. * math/test-nearbyint-except-2.c [!NO_LONG_DOUBLE]: Likewise. * math/test-nearbyint-except.c [!NO_LONG_DOUBLE]: Likewise. * math/test-powl.c [!NO_LONG_DOUBLE]: Likewise. * math/test-signgam-finite-c99.c [!NO_LONG_DOUBLE]: Likewise. * math/test-signgam-finite.c [!NO_LONG_DOUBLE]: Likewise. * math/test-signgam-main.c [!NO_LONG_DOUBLE]: Likewise. * math/test-snan.c [!NO_LONG_DOUBLE]: Likewise. * math/test-tgmath-ret.c [!NO_LONG_DOUBLE]: Likewise. * math/test-tgmath.c: Include <float.h>. [!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG > DBL_MANT_DIG]. * math/test-tgmath2.c: Include <float.h>. [!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG > DBL_MANT_DIG].
2017-01-02Fix math/test-nearbyint-except for no-exceptions configurations.Joseph Myers
The test math/test-nearbyint-except conditions some of its tests on an EXCEPTION_TESTS call, not not all that need such a condition. This patch fixes it to use such a conditional for all its tests and to return 77 (UNSUPPORTED) if none of the floating-point types tested support exceptions. Tested for mips64 soft float (where the test previously failed and is now UNSUPPORTED); also tested for x86_64 to make sure the test still PASSes in exceptions-supported cases. * math/test-nearbyint-except.c: Include <stdbool.h>. (any_supported): New variable. (TEST_FUNC): Return early if !EXCEPTION_TESTS (FLOAT). Otherwise set any_supported. (do_test): Return 77 if no floating-point type supported exceptions.
2017-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2016-01-04Update copyright dates with scripts/update-copyrights.Joseph Myers
2015-10-22Fix i386 / x86_64 nearbyint exception clearing (bug 15491).Joseph Myers
The implementations of nearbyint functions using x87 floating point (i386 all versions, x86_64 long double only) use the fclex instruction, which clears any exceptions that were raised before the function was called. These functions must not clear exceptions that were raised before they were called. This patch fixes these functions to save and restore the whole floating-point environment (fnstenv / fldenv) as the way of avoiding raising "inexact" (recall that there isn't an x87 instruction for loading just the status word, so the whole environment has to be saved and loaded instead - the code already saved and loaded the control word, which is now obtained from the saved environment after this patch, to disable traps on "inexact"). In the case of the long double functions, any "invalid" exception from frndint (applied to a signaling NaN) needs merging into the saved state; this issue doesn't apply to the float and double functions because that exception would have been raised when the argument is loaded, before the environment is saved. [BZ #15491] * sysdeps/i386/fpu/s_nearbyint.S (__nearbyint): Save and restore floating-point environment instead of clearing all exceptions. * sysdeps/i386/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sysdeps/i386/fpu/s_nearbyintl.S (__nearbyintl): Likewise, merging in "invalid" exceptions from frndint. * sysdeps/x86_64/fpu/s_nearbyintl.S (__nearbyintl): Likewise. * math/test-nearbyint-except.c: New file. * math/Makefile (tests): Add test-nearbyint-except.