summaryrefslogtreecommitdiff
path: root/tests/tset_f.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-01-06 12:30:41 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-01-06 12:30:41 +0000
commit7d40814b714eb46837b2909d146e5a5008e332cf (patch)
treed6c8c9ededbc96c2779ee48d60a021dc132f09dc /tests/tset_f.c
parent523e3a6ffb2e29853cb75ad1f7a7df71bccb246f (diff)
downloadmpfr-7d40814b714eb46837b2909d146e5a5008e332cf.tar.gz
Add the tests to check if 0 for signed class with unsigned 0 is set to 0+.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2595 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tset_f.c')
-rw-r--r--tests/tset_f.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/tset_f.c b/tests/tset_f.c
index f61942cb8..9d85566a5 100644
--- a/tests/tset_f.c
+++ b/tests/tset_f.c
@@ -31,6 +31,7 @@ main (void)
mpfr_t x, u;
mpf_t y, z;
unsigned long k, pr;
+ int r, inexact;
tests_start_mpfr ();
@@ -71,17 +72,32 @@ main (void)
}
mpfr_clear(u);
- mpfr_clear(x);
for (k = 1; k <= 100000; k++)
{
pr = 2 + (randlimb () & 255);
mpf_set_prec (z, pr);
mpf_random2 (z, z->_mp_prec, 0);
- mpfr_init2 (x, pr);
+ mpfr_set_prec (x, pr);
mpfr_set_f (x, z, 0);
- mpfr_clear (x);
}
+
+ /* Check for +0 */
+ mpfr_set_prec(x, 53);
+ mpf_set_prec(y, 53);
+ mpf_set_ui(y, 0);
+ for(r = 0 ; r < 4 ; r++)
+ {
+ inexact = mpfr_set_f(x, y, r);
+ if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact)
+ {
+ printf("mpfr_set_f(x,0) failed for %s\n",
+ mpfr_print_rnd_mode(r));
+ exit(1);
+ }
+ }
+
+ mpfr_clear (x);
mpf_clear (y);
mpf_clear (z);