summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2021-02-01 07:50:38 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2021-02-01 07:50:38 +0000
commit7fc0b0d10f9b2f30b14ed77e3b76d4da87a957f2 (patch)
treebce2da470588d79f2a632936c8b3e63200133fb8 /tests
parent97d6c8229f55a8e860a12793db7a3c3704e08205 (diff)
downloadmpfr-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.c37
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);