diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2021-02-01 07:50:38 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2021-02-01 07:50:38 +0000 |
commit | 7fc0b0d10f9b2f30b14ed77e3b76d4da87a957f2 (patch) | |
tree | bce2da470588d79f2a632936c8b3e63200133fb8 /tests | |
parent | 97d6c8229f55a8e860a12793db7a3c3704e08205 (diff) | |
download | mpfr-7fc0b0d10f9b2f30b14ed77e3b76d4da87a957f2.tar.gz |
[src/acosu.c] for u=0 and |x| > 1, return NaN
[tests/tacosu.c] added corresponding test
git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14293 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tacosu.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/tests/tacosu.c b/tests/tacosu.c index bfe14b382..c4bd458ed 100644 --- a/tests/tacosu.c +++ b/tests/tacosu.c @@ -77,16 +77,6 @@ main (void) } } - /* check case u=0 */ - mpfr_set_ui_2exp (x, 1, -1, MPFR_RNDN); - mpfr_acosu (y, x, 0, MPFR_RNDN); - if (!mpfr_zero_p (y) || MPFR_SIGN(y) < 0) - { - printf ("Error: acosu (1/2, 0) != +0\n"); - printf ("got: "); mpfr_dump (y); - exit (1); - } - /* check case |x| > 1 */ mpfr_set_ui (x, 2, MPFR_RNDN); mpfr_acosu (y, x, 1, MPFR_RNDN); @@ -104,6 +94,33 @@ main (void) exit (1); } + /* check case |x| > 1 with u=0 */ + mpfr_set_ui (x, 2, MPFR_RNDN); + mpfr_acosu (y, x, 0, MPFR_RNDN); + if (mpfr_nan_p (y) == 0) + { + printf ("Error: acosu (2, 0) != NaN\n"); + exit (1); + } + + mpfr_set_si (x, -2, MPFR_RNDN); + mpfr_acosu (y, x, 0, MPFR_RNDN); + if (mpfr_nan_p (y) == 0) + { + printf ("Error: acosu (-2, 0) != NaN\n"); + exit (1); + } + + /* check case u=0 */ + mpfr_set_ui_2exp (x, 1, -1, MPFR_RNDN); + mpfr_acosu (y, x, 0, MPFR_RNDN); + if (!mpfr_zero_p (y) || MPFR_SIGN(y) < 0) + { + printf ("Error: acosu (1/2, 0) != +0\n"); + printf ("got: "); mpfr_dump (y); + exit (1); + } + /* acosu (1,u) = +0 */ mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_acosu (y, x, 1, MPFR_RNDN); |