diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-08-20 19:41:15 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-08-20 19:41:15 +0000 |
commit | c980f2f4fe0f5d301f706017a1f7e4e942193ec0 (patch) | |
tree | a8a3c9c159747a9eed2acaa20a65e19d8b23a5c4 /math | |
parent | 0716c4fc9fff70870e28f84d18ddbce1db162101 (diff) | |
download | glibc-c980f2f4fe0f5d301f706017a1f7e4e942193ec0.tar glibc-c980f2f4fe0f5d301f706017a1f7e4e942193ec0.tar.gz glibc-c980f2f4fe0f5d301f706017a1f7e4e942193ec0.tar.bz2 glibc-c980f2f4fe0f5d301f706017a1f7e4e942193ec0.zip |
Fix cproj handling of (finite, NaN) arguments (bug 15531).
Diffstat (limited to 'math')
-rw-r--r-- | math/libm-test.inc | 40 | ||||
-rw-r--r-- | math/s_cproj.c | 4 | ||||
-rw-r--r-- | math/s_cprojf.c | 4 | ||||
-rw-r--r-- | math/s_cprojl.c | 4 |
4 files changed, 43 insertions, 9 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index 851f1beafc..25ea33603c 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -7066,11 +7066,51 @@ static const struct test_c_c_data cproj_test_data[] = TEST_c_c (cproj, qnan_value, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, plus_zero, qnan_value, plus_zero, qnan_value, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, minus_zero, qnan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, qnan_value, plus_zero, qnan_value, plus_zero, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, qnan_value, minus_zero, qnan_value, minus_zero, NO_INEXACT_EXCEPTION), + + TEST_c_c (cproj, 1.0, qnan_value, 1.0, qnan_value, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, -1.0, qnan_value, -1.0, qnan_value, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, qnan_value, 1.0, qnan_value, 1.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, qnan_value, -1.0, qnan_value, -1.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0, NO_INEXACT_EXCEPTION), TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0, NO_INEXACT_EXCEPTION), TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, plus_infty, plus_zero, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, plus_infty, minus_zero, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, minus_infty, plus_zero, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, minus_infty, minus_zero, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + + TEST_c_c (cproj, plus_zero, plus_infty, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, plus_zero, minus_infty, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, minus_zero, plus_infty, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, minus_zero, minus_infty, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + + TEST_c_c (cproj, plus_infty, 1.0, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, plus_infty, -1.0, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, minus_infty, 1.0, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, minus_infty, -1.0, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + + TEST_c_c (cproj, 1.0, plus_infty, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, 1.0, minus_infty, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, -1.0, plus_infty, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, -1.0, minus_infty, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + + TEST_c_c (cproj, plus_infty, qnan_value, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, plus_infty, -qnan_value, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, minus_infty, qnan_value, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, minus_infty, -qnan_value, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + + TEST_c_c (cproj, qnan_value, plus_infty, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, qnan_value, minus_infty, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, -qnan_value, plus_infty, plus_infty, 0.0, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, -qnan_value, minus_infty, plus_infty, minus_zero, NO_INEXACT_EXCEPTION), + TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0, NO_INEXACT_EXCEPTION), TEST_c_c (cproj, 2.0, 3.0, 2.0, 3.0, NO_INEXACT_EXCEPTION), }; diff --git a/math/s_cproj.c b/math/s_cproj.c index c0be4618db..98f1a4c4b2 100644 --- a/math/s_cproj.c +++ b/math/s_cproj.c @@ -24,9 +24,7 @@ __complex__ double __cproj (__complex__ double x) { - if (isnan (__real__ x) && isnan (__imag__ x)) - return x; - else if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + if (__isinf_ns (__real__ x) || __isinf_ns (__imag__ x)) { __complex__ double res; diff --git a/math/s_cprojf.c b/math/s_cprojf.c index 188bbe3beb..e4dbc181bd 100644 --- a/math/s_cprojf.c +++ b/math/s_cprojf.c @@ -24,9 +24,7 @@ __complex__ float __cprojf (__complex__ float x) { - if (isnan (__real__ x) && isnan (__imag__ x)) - return x; - else if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + if (__isinf_nsf (__real__ x) || __isinf_nsf (__imag__ x)) { __complex__ float res; diff --git a/math/s_cprojl.c b/math/s_cprojl.c index fbdf2797e4..b564a83e63 100644 --- a/math/s_cprojl.c +++ b/math/s_cprojl.c @@ -24,9 +24,7 @@ __complex__ long double __cprojl (__complex__ long double x) { - if (isnan (__real__ x) && isnan (__imag__ x)) - return x; - else if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + if (__isinf_nsl (__real__ x) || __isinf_nsl (__imag__ x)) { __complex__ long double res; |