summaryrefslogtreecommitdiff
path: root/tests/tmul_d.c
diff options
context:
space:
mode:
authorthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2007-09-11 13:01:54 +0000
committerthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2007-09-11 13:01:54 +0000
commit5e318e2944fa3d5de3f58c4ec1ab2224d4873008 (patch)
tree684929f665eaba133e642665b1cde1fd0b04ecd3 /tests/tmul_d.c
parenta10a8c4f72d895d795d20749b7ba79fed4c95b17 (diff)
downloadmpfr-5e318e2944fa3d5de3f58c4ec1ab2224d4873008.tar.gz
add some simple test cases in tadd_d.c and friends
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4837 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tmul_d.c')
-rw-r--r--tests/tmul_d.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/tmul_d.c b/tests/tmul_d.c
index 19e61953b..e524679fa 100644
--- a/tests/tmul_d.c
+++ b/tests/tmul_d.c
@@ -67,9 +67,40 @@ check_nans (void)
int
main (int argc, char *argv[])
{
+ mpfr_t x, y, z;
+ double d;
+ int inexact;
MPFR_TEST_USE_RANDS ();
tests_start_mpfr ();
+ /* check with enough precision */
+ mpfr_init2 (x, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (y, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (z, IEEE_DBL_MANT_DIG);
+
+ mpfr_set_str (y, "4096", 10, GMP_RNDN);
+ d = 0.125;
+ mpfr_clear_flags ();
+ inexact = mpfr_mul_d (x, y, d, GMP_RNDN);
+ if (inexact != 0)
+ {
+ printf ("Inexact flag error in mpfr_mul_d\n");
+ exit (1);
+ }
+ mpfr_set_str (z, "512", 10, GMP_RNDN);
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_mul_d (");
+ mpfr_out_str (stdout, 10, 0, y, GMP_RNDN);
+ printf (" + %.20g)\nexpected ", d);
+ mpfr_out_str (stdout, 10, 0, z, GMP_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, (void *)0);
+
check_nans ();
test_generic (2, 1000, 100);