diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2013-02-28 17:12:25 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2013-03-15 19:06:02 +0100 |
commit | 67e971f18ffc9b3ea57cbccba54d5203d1e6a988 (patch) | |
tree | f62ff6123ac01815295b6d6f6f9dba73c1c65862 /sysdeps | |
parent | 64487e126468f91ecdfe7ab7a0f3a82762874d5a (diff) | |
download | glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.tar.gz glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.tar.xz glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.zip |
Better distinguish between NaN/qNaN/sNaN.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/ieee754/bits/nan.h | 10 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/fenv.h | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/fpu/fenv_libc.h | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/fpu/test-powerpc-snan.c | 92 |
4 files changed, 55 insertions, 55 deletions
diff --git a/sysdeps/ieee754/bits/nan.h b/sysdeps/ieee754/bits/nan.h index 935271a7c0..41f47ba097 100644 --- a/sysdeps/ieee754/bits/nan.h +++ b/sysdeps/ieee754/bits/nan.h @@ -39,14 +39,14 @@ # include <endian.h> # if __BYTE_ORDER == __BIG_ENDIAN -# define __nan_bytes { 0x7f, 0xc0, 0, 0 } +# define __qnan_bytes { 0x7f, 0xc0, 0, 0 } # endif # if __BYTE_ORDER == __LITTLE_ENDIAN -# define __nan_bytes { 0, 0, 0xc0, 0x7f } +# define __qnan_bytes { 0, 0, 0xc0, 0x7f } # endif -static union { unsigned char __c[4]; float __d; } __nan_union - __attribute__ ((__unused__)) = { __nan_bytes }; -# define NAN (__nan_union.__d) +static union { unsigned char __c[4]; float __d; } __qnan_union + __attribute__ ((__unused__)) = { __qnan_bytes }; +# define NAN (__qnan_union.__d) #endif /* GCC. */ diff --git a/sysdeps/powerpc/bits/fenv.h b/sysdeps/powerpc/bits/fenv.h index 23c593829b..122edd3dc3 100644 --- a/sysdeps/powerpc/bits/fenv.h +++ b/sysdeps/powerpc/bits/fenv.h @@ -54,7 +54,7 @@ enum these bits is set. Note, though, that you can't disable or enable these exceptions individually. */ - /* Operation with SNaN. */ + /* Operation with a sNaN. */ FE_INVALID_SNAN = # define FE_INVALID_SNAN (1 << (31 - 7)) FE_INVALID_SNAN, @@ -79,7 +79,7 @@ enum # define FE_INVALID_IMZ (1 << (31 - 11)) FE_INVALID_IMZ, - /* Comparison with NaN or SNaN. */ + /* Comparison with a NaN. */ FE_INVALID_COMPARE = # define FE_INVALID_COMPARE (1 << (31 - 12)) FE_INVALID_COMPARE, diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h index abae2f3dfb..1910951568 100644 --- a/sysdeps/powerpc/fpu/fenv_libc.h +++ b/sysdeps/powerpc/fpu/fenv_libc.h @@ -116,7 +116,7 @@ enum { FPSCR_UX, /* underflow */ FPSCR_ZX, /* zero divide */ FPSCR_XX, /* inexact */ - FPSCR_VXSNAN, /* invalid operation for SNaN */ + FPSCR_VXSNAN, /* invalid operation for sNaN */ FPSCR_VXISI, /* invalid operation for Inf-Inf */ FPSCR_VXIDI, /* invalid operation for Inf/Inf */ FPSCR_VXZDZ, /* invalid operation for 0/0 */ @@ -152,7 +152,7 @@ enum { #endif /* _ARCH_PWR6 */ /* This operation (i) sets the appropriate FPSCR bits for its - parameter, (ii) converts SNaN to the corresponding NaN, and (iii) + parameter, (ii) converts sNaN to the corresponding qNaN, and (iii) otherwise passes its parameter through unchanged (in particular, -0 and +0 stay as they were). The `obvious' way to do this is optimised out by gcc. */ diff --git a/sysdeps/powerpc/fpu/test-powerpc-snan.c b/sysdeps/powerpc/fpu/test-powerpc-snan.c index e3bd47abaf..f8b5595d8c 100644 --- a/sysdeps/powerpc/fpu/test-powerpc-snan.c +++ b/sysdeps/powerpc/fpu/test-powerpc-snan.c @@ -1,4 +1,4 @@ -/* Test Signalling NaN in isnan, isinf etc functions. +/* Test signaling NaNs in isnan, isinf, and similar functions. Copyright (C) 2008-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 2005. @@ -136,19 +136,19 @@ NAME (void) \ { \ /* Variables are declared volatile to forbid some compiler \ optimizations. */ \ - volatile FLOAT Inf_var, NaN_var, zero_var, one_var, SNaN_var; \ + volatile FLOAT Inf_var, qNaN_var, zero_var, one_var, sNaN_var; \ fenv_t saved_fenv; \ \ zero_var = 0.0; \ one_var = 1.0; \ - NaN_var = zero_var / zero_var; \ - SNaN_var = snan_##FLOAT (); \ + qNaN_var = zero_var / zero_var; \ + sNaN_var = snan_##FLOAT (); \ Inf_var = one_var / zero_var; \ \ (void) &zero_var; \ (void) &one_var; \ - (void) &NaN_var; \ - (void) &SNaN_var; \ + (void) &qNaN_var; \ + (void) &sNaN_var; \ (void) &Inf_var; \ \ set_sigaction_FP (); \ @@ -158,200 +158,200 @@ NAME (void) \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isnan(NaN) raised SIGFPE\n"); \ + printf (#FLOAT " isnan (qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isnan (NaN)", isnan (NaN_var)); \ + check (#FLOAT " isnan (qNaN)", isnan (qNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isnan(-NaN) raised SIGFPE\n"); \ + printf (#FLOAT " isnan (-qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isnan (-NaN)", isnan (-NaN_var)); \ + check (#FLOAT " isnan (-qNaN)", isnan (-qNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isnan(SNaN) raised SIGFPE\n"); \ + printf (#FLOAT " isnan (sNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isnan (SNaN)", isnan (SNaN_var)); \ + check (#FLOAT " isnan (sNaN)", isnan (sNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isnan(-SNaN) raised SIGFPE\n"); \ + printf (#FLOAT " isnan (-sNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isnan (-SNaN)", isnan (-SNaN_var)); \ + check (#FLOAT " isnan (-sNaN)", isnan (-sNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isinf(NaN) raised SIGFPE\n"); \ + printf (#FLOAT " isinf (qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isinf (NaN)", !isinf (NaN_var)); \ + check (#FLOAT " isinf (qNaN)", !isinf (qNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isinf(-NaN) raised SIGFPE\n"); \ + printf (#FLOAT " isinf (-qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isinf (-NaN)", !isinf (-NaN_var)); \ + check (#FLOAT " isinf (-qNaN)", !isinf (-qNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isinf(SNaN) raised SIGFPE\n"); \ + printf (#FLOAT " isinf (sNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isinf (SNaN)", !isinf (SNaN_var)); \ + check (#FLOAT " isinf (sNaN)", !isinf (sNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isinf(-SNaN) raised SIGFPE\n"); \ + printf (#FLOAT " isinf (-sNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isinf (-SNaN)", !isinf (-SNaN_var)); \ + check (#FLOAT " isinf (-sNaN)", !isinf (-sNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isfinite(NaN) raised SIGFPE\n"); \ + printf (#FLOAT " isfinite (qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isfinite (NaN)", !isfinite (NaN_var)); \ + check (#FLOAT " isfinite (qNaN)", !isfinite (qNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isfinite(-NaN) raised SIGFPE\n"); \ + printf (#FLOAT " isfinite (-qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isfinite (-NaN)", !isfinite (-NaN_var)); \ + check (#FLOAT " isfinite (-qNaN)", !isfinite (-qNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isfinite(SNaN) raised SIGFPE\n"); \ + printf (#FLOAT " isfinite (sNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isfinite (SNaN)", !isfinite (SNaN_var)); \ + check (#FLOAT " isfinite (sNaN)", !isfinite (sNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isfinite(-SNaN) raised SIGFPE\n"); \ + printf (#FLOAT " isfinite (-sNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isfinite (-SNaN)", !isfinite (-SNaN_var)); \ + check (#FLOAT " isfinite (-sNaN)", !isfinite (-sNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isnormal(NaN) raised SIGFPE\n"); \ + printf (#FLOAT " isnormal (qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isnormal (NaN)", !isnormal (NaN_var)); \ + check (#FLOAT " isnormal (qNaN)", !isnormal (qNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isnormal(-NaN) raised SIGFPE\n"); \ + printf (#FLOAT " isnormal (-qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isnormal (-NaN)", !isnormal (-NaN_var)); \ + check (#FLOAT " isnormal (-qNaN)", !isnormal (-qNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isnormal(SNaN) isnormal SIGFPE\n"); \ + printf (#FLOAT " isnormal (sNaN) isnormal SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isnormal (SNaN)", !isnormal (SNaN_var)); \ + check (#FLOAT " isnormal (sNaN)", !isnormal (sNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " isnormal(-SNaN) raised SIGFPE\n"); \ + printf (#FLOAT " isnormal (-sNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " isnormal (-SNaN)", !isnormal (-SNaN_var)); \ + check (#FLOAT " isnormal (-sNaN)", !isnormal (-sNaN_var)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " fpclassify(NaN) raised SIGFPE\n"); \ + printf (#FLOAT " fpclassify (qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " fpclassify (NaN)", (fpclassify (NaN_var)==FP_NAN)); \ + check (#FLOAT " fpclassify (qNaN)", (fpclassify (qNaN_var)==FP_NAN)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " fpclassify(-NaN) raised SIGFPE\n"); \ + printf (#FLOAT " fpclassify (-qNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " fpclassify (-NaN)", (fpclassify (-NaN_var)==FP_NAN)); \ + check (#FLOAT " fpclassify (-qNaN)", (fpclassify (-qNaN_var)==FP_NAN)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " fpclassify(SNaN) isnormal SIGFPE\n"); \ + printf (#FLOAT " fpclassify (sNaN) isnormal SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " fpclassify (SNaN)", (fpclassify (SNaN_var)==FP_NAN)); \ + check (#FLOAT " fpclassify (sNaN)", (fpclassify (sNaN_var)==FP_NAN)); \ } \ \ feclearexcept(FE_ALL_EXCEPT); \ feenableexcept (FE_ALL_EXCEPT); \ if (sigsetjmp(sigfpe_buf, 0)) \ { \ - printf (#FLOAT " fpclassify(-SNaN) raised SIGFPE\n"); \ + printf (#FLOAT " fpclassify (-sNaN) raised SIGFPE\n"); \ errors++; \ } else { \ - check (#FLOAT " fpclassify (-SNaN)", (fpclassify (-SNaN_var)==FP_NAN)); \ + check (#FLOAT " fpclassify (-sNaN)", (fpclassify (-sNaN_var)==FP_NAN)); \ } \ \ fesetenv(&saved_fenv); /* restore saved fenv */ \ |