summaryrefslogtreecommitdiff
path: root/tests/tcompound.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2021-02-03 10:56:47 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2021-02-03 10:56:47 +0000
commitb26277f5982ab353ff5e204daa7ba8e10b8609df (patch)
treef0978cbe58c696a056f0f90a07699c11535dab14 /tests/tcompound.c
parent82fcff31373611cb428493b9e9f9fc63bbb87fd2 (diff)
downloadmpfr-b26277f5982ab353ff5e204daa7ba8e10b8609df.tar.gz
[src/compound.c] completed the general case
[tests/tcompound.c] added one hard-coded test git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14341 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tcompound.c')
-rw-r--r--tests/tcompound.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/tcompound.c b/tests/tcompound.c
index e66661863..43f481d84 100644
--- a/tests/tcompound.c
+++ b/tests/tcompound.c
@@ -158,6 +158,20 @@ check_ieee754 (void)
exit (1);
}
+ /* hard-coded test: x is the 32-bit nearest approximation of 17/42 */
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_ui_2exp (x, 3476878287UL, -33, MPFR_RNDN);
+ mpfr_compound (y, x, 12, MPFR_RNDN);
+ mpfr_set_ui_2exp (x, 1981447393UL, -25, MPFR_RNDN);
+ if (!mpfr_equal_p (y, x))
+ {
+ printf ("Error for compound(3476878287/2^33,12)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
mpfr_clear (x);
mpfr_clear (y);
}