summaryrefslogtreecommitdiff
path: root/tests/tset_f.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-18 10:41:00 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-18 10:41:00 +0000
commit9aaa91d7bcfb3165ebf1b25d734fd4a53a09506b (patch)
tree68a0f23f592adf1091e8df522c671d8e1a285029 /tests/tset_f.c
parente0c173aa446074d17178356b315fe870631f158d (diff)
downloadmpfr-9aaa91d7bcfb3165ebf1b25d734fd4a53a09506b.tar.gz
Fixed a bug in mpfr_set_f for 0 (wrong sign) and added the test.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2761 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tset_f.c')
-rw-r--r--tests/tset_f.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/tset_f.c b/tests/tset_f.c
index 8d4544971..8178eb566 100644
--- a/tests/tset_f.c
+++ b/tests/tset_f.c
@@ -101,13 +101,19 @@ main (void)
mpf_set_ui (y, 0);
for(r = 0 ; r < GMP_RND_MAX ; 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);
- }
+ int i;
+ for (i = -1; i <= 1; i++)
+ {
+ if (i)
+ mpfr_set_si (x, i, GMP_RNDN);
+ 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, i = %d\n",
+ mpfr_print_rnd_mode (r), i);
+ exit (1);
+ }
+ }
}
/* coverage test */