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/powerpc/fpu | |
parent | 64487e126468f91ecdfe7ab7a0f3a82762874d5a (diff) | |
download | glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.tar glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.tar.gz glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.tar.bz2 glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.zip |
Better distinguish between NaN/qNaN/sNaN.
Diffstat (limited to 'sysdeps/powerpc/fpu')
-rw-r--r-- | sysdeps/powerpc/fpu/fenv_libc.h | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/fpu/test-powerpc-snan.c | 92 |
2 files changed, 48 insertions, 48 deletions
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 */ \ |