diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-01-22 22:30:52 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-01-22 22:30:52 +0000 |
commit | 031deac645662aea8a72a5ed0c0bf148e609e681 (patch) | |
tree | 07c68b885a0c39a228ca4b0f7f901a9117f85a9f /tests/tfrac.c | |
parent | 039c1c0135bac8353d17020543fe8b27f3b1937e (diff) | |
download | mpfr-031deac645662aea8a72a5ed0c0bf148e609e681.tar.gz |
added several hard-coded tests (and fixed bugs found)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2644 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tfrac.c')
-rw-r--r-- | tests/tfrac.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/tfrac.c b/tests/tfrac.c index d17aa740d..7f51133c6 100644 --- a/tests/tfrac.c +++ b/tests/tfrac.c @@ -1,6 +1,6 @@ /* Test file for mpfr_frac. -Copyright 2002, 2003 Free Software Foundation. +Copyright 2002, 2003, 2004 Free Software Foundation. This file is part of the MPFR Library. @@ -128,6 +128,38 @@ check1 (mpfr_ptr ip, mpfr_ptr fp) } } +static void +special (void) +{ + mpfr_t z, t; + + mpfr_init2 (z, 6); + mpfr_init2 (t, 3); + + mpfr_set_str_binary (z, "0.101101E3"); + mpfr_frac (t, z, GMP_RNDN); + mpfr_set_str_binary (z, "0.101"); + if (mpfr_cmp (t, z)) + { + printf ("Error in frac(0.101101E3)\n"); + exit (1); + } + + mpfr_set_prec (z, 34); + mpfr_set_prec (t, 26); + mpfr_set_str_binary (z, "0.101101010000010011110011001101E9"); + mpfr_frac (t, z, GMP_RNDN); + mpfr_set_str_binary (z, "0.000010011110011001101"); + if (mpfr_cmp (t, z)) + { + printf ("Error in frac(0.101101010000010011110011001101E9)\n"); + exit (1); + } + + mpfr_clear (z); + mpfr_clear (t); +} + int main (void) { @@ -136,6 +168,8 @@ main (void) tests_start_mpfr (); + special (); + mpfr_init2 (ip, PIP); mpfr_init2 (fp, PFP); |