diff options
Diffstat (limited to 'math')
-rw-r--r-- | math/Makefile | 5 | ||||
-rw-r--r-- | math/fenv.h | 8 | ||||
-rw-r--r-- | math/test-fe-snans-always-signal.c | 38 |
3 files changed, 50 insertions, 1 deletions
diff --git a/math/Makefile b/math/Makefile index 076fd34..db6ea29 100644 --- a/math/Makefile +++ b/math/Makefile @@ -175,7 +175,8 @@ tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \ test-fesetexcept-traps test-fetestexceptflag test-femode \ test-femode-traps test-iszero-excess-precision \ test-iseqsig-excess-precision test-flt-eval-method \ - test-fp-ilogb-constants test-fp-llogb-constants $(tests-static) + test-fp-ilogb-constants test-fp-llogb-constants \ + test-fe-snans-always-signal $(tests-static) tests-static = test-fpucw-static test-fpucw-ieee-static \ test-signgam-uchar-static test-signgam-uchar-init-static \ test-signgam-uint-static test-signgam-uint-init-static \ @@ -290,6 +291,8 @@ CFLAGS-test-iszero-excess-precision.c = -fexcess-precision=standard CFLAGS-test-iseqsig-excess-precision.c = -fexcess-precision=standard CFLAGS-test-flt-eval-method.c = -fexcess-precision=standard +CFLAGS-test-fe-snans-always-signal.c = -fsignaling-nans + # The -lieee module sets the _LIB_VERSION_ switch to IEEE mode # for error handling in the -lm functions. install-lib += libieee.a diff --git a/math/fenv.h b/math/fenv.h index 9006aa2..f783447 100644 --- a/math/fenv.h +++ b/math/fenv.h @@ -145,6 +145,14 @@ extern int fesetmode (const femode_t *__modep) __THROW; # include <bits/fenvinline.h> #endif +/* NaN support. */ + +#if (__GLIBC_USE (IEC_60559_BFP_EXT) \ + && defined FE_INVALID \ + && defined __SUPPORT_SNAN__) +# define FE_SNANS_ALWAYS_SIGNAL 1 +#endif + #ifdef __USE_GNU /* Enable individual exceptions. Will not enable more exceptions than diff --git a/math/test-fe-snans-always-signal.c b/math/test-fe-snans-always-signal.c new file mode 100644 index 0000000..2459feb --- /dev/null +++ b/math/test-fe-snans-always-signal.c @@ -0,0 +1,38 @@ +/* Test FE_SNANS_ALWAYS_SIGNAL definition. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <fenv.h> + +#ifdef FE_INVALID +# ifndef FE_SNANS_ALWAYS_SIGNAL +# error "FE_SNANS_ALWAYS_SIGNAL not defined" +# endif +#else +# ifdef FE_SNANS_ALWAYS_SIGNAL +# error "FE_SNANS_ALWAYS_SIGNAL defined, but no FE_INVALID support" +# endif +#endif + +int +do_test (void) +{ + /* This is a compilation test. */ + return 0; +} + +#include <support/test-driver.c> |