diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-04-30 09:38:06 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-04-30 09:38:06 +0000 |
commit | 5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81 (patch) | |
tree | 5dfe27d20ca6c9d2549d2ecd7f2dd565832dc2b0 /math/libm-test.inc | |
parent | 9568c0c2255045456a09b441f89c6641e27a4bec (diff) | |
download | glibc-5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81.tar.gz glibc-5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81.tar.xz glibc-5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81.zip |
Fix acos (-1) in round-downwards mode on x86 (bug 14034).
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r-- | math/libm-test.inc | 248 |
1 files changed, 248 insertions, 0 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index cd627cd829..bedff09fea 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -761,6 +761,126 @@ acos_test (void) END (acos); } + +static void +acos_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(acos) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (acos_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (acos, 0, M_PI_2l); + TEST_f_f (acos, minus_zero, M_PI_2l); + TEST_f_f (acos, 1, 0); + TEST_f_f (acos, -1, M_PIl); + TEST_f_f (acos, 0.5, M_PI_6l*2.0); + TEST_f_f (acos, -0.5, M_PI_6l*4.0); + } + + fesetround (save_round_mode); + + END (acos_tonearest); +} + + +static void +acos_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(acos) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (acos_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (acos, 0, M_PI_2l); + TEST_f_f (acos, minus_zero, M_PI_2l); + TEST_f_f (acos, 1, 0); + TEST_f_f (acos, -1, M_PIl); + TEST_f_f (acos, 0.5, M_PI_6l*2.0); + TEST_f_f (acos, -0.5, M_PI_6l*4.0); + } + + fesetround (save_round_mode); + + END (acos_towardzero); +} + + +static void +acos_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(acos) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (acos_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (acos, 0, M_PI_2l); + TEST_f_f (acos, minus_zero, M_PI_2l); + TEST_f_f (acos, 1, 0); + TEST_f_f (acos, -1, M_PIl); + TEST_f_f (acos, 0.5, M_PI_6l*2.0); + TEST_f_f (acos, -0.5, M_PI_6l*4.0); + } + + fesetround (save_round_mode); + + END (acos_downward); +} + + +static void +acos_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(acos) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (acos_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (acos, 0, M_PI_2l); + TEST_f_f (acos, minus_zero, M_PI_2l); + TEST_f_f (acos, 1, 0); + TEST_f_f (acos, -1, M_PIl); + TEST_f_f (acos, 0.5, M_PI_6l*2.0); + TEST_f_f (acos, -0.5, M_PI_6l*4.0); + } + + fesetround (save_round_mode); + + END (acos_upward); +} + static void acosh_test (void) { @@ -817,6 +937,126 @@ asin_test (void) END (asin); } + +static void +asin_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(asin) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (asin_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (asin, 0, 0); + TEST_f_f (asin, minus_zero, minus_zero); + TEST_f_f (asin, 0.5, M_PI_6l); + TEST_f_f (asin, -0.5, -M_PI_6l); + TEST_f_f (asin, 1.0, M_PI_2l); + TEST_f_f (asin, -1.0, -M_PI_2l); + } + + fesetround (save_round_mode); + + END (asin_tonearest); +} + + +static void +asin_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(asin) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (asin_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (asin, 0, 0); + TEST_f_f (asin, minus_zero, minus_zero); + TEST_f_f (asin, 0.5, M_PI_6l); + TEST_f_f (asin, -0.5, -M_PI_6l); + TEST_f_f (asin, 1.0, M_PI_2l); + TEST_f_f (asin, -1.0, -M_PI_2l); + } + + fesetround (save_round_mode); + + END (asin_towardzero); +} + + +static void +asin_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(asin) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (asin_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (asin, 0, 0); + TEST_f_f (asin, minus_zero, minus_zero); + TEST_f_f (asin, 0.5, M_PI_6l); + TEST_f_f (asin, -0.5, -M_PI_6l); + TEST_f_f (asin, 1.0, M_PI_2l); + TEST_f_f (asin, -1.0, -M_PI_2l); + } + + fesetround (save_round_mode); + + END (asin_downward); +} + + +static void +asin_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(asin) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (asin_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (asin, 0, 0); + TEST_f_f (asin, minus_zero, minus_zero); + TEST_f_f (asin, 0.5, M_PI_6l); + TEST_f_f (asin, -0.5, -M_PI_6l); + TEST_f_f (asin, 1.0, M_PI_2l); + TEST_f_f (asin, -1.0, -M_PI_2l); + } + + fesetround (save_round_mode); + + END (asin_upward); +} + static void asinh_test (void) { @@ -8194,7 +8434,15 @@ main (int argc, char **argv) /* Trigonometric functions: */ acos_test (); + acos_test_tonearest (); + acos_test_towardzero (); + acos_test_downward (); + acos_test_upward (); asin_test (); + asin_test_tonearest (); + asin_test_towardzero (); + asin_test_downward (); + asin_test_upward (); atan_test (); atan2_test (); cos_test (); |