diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2002-03-11 13:35:12 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2002-03-11 13:35:12 +0000 |
commit | 319353cebfeec3ba19861497d867c165b7a0939a (patch) | |
tree | 6acea79856c4fcc53a128b6fd1addfee3012d4ef | |
parent | 5c4878caf36a75b23817d7ef7327293e286cafeb (diff) | |
download | mpfr-319353cebfeec3ba19861497d867c165b7a0939a.tar.gz |
fixed typo (ai [potentially unsigned] replaced by i)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1727 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | set_si.c | 2 | ||||
-rw-r--r-- | tests/tset_si.c | 19 |
2 files changed, 20 insertions, 1 deletions
@@ -67,7 +67,7 @@ mpfr_set_si (mpfr_ptr x, long i, mp_rnd_t rnd_mode) mp_exp_t exp = MPFR_EXP(x); if (exp == __mpfr_emax) - return mpfr_set_overflow(x, rnd_mode, (ai < 0 ? -1 : 1)); + return mpfr_set_overflow(x, rnd_mode, (i < 0 ? -1 : 1)); MPFR_EXP(x)++; xp[xn] = MP_LIMB_T_HIGHBIT; diff --git a/tests/tset_si.c b/tests/tset_si.c index 1cef316fe..7de85520a 100644 --- a/tests/tset_si.c +++ b/tests/tset_si.c @@ -139,6 +139,25 @@ main (int argc, char *argv[]) exit (1); } + /* check potential bug in case mp_limb_t is unsigned */ + mpfr_set_emax (0); + mpfr_set_si (x, -1, GMP_RNDN); + if (mpfr_sgn (x) >= 0) + { + fprintf (stderr, "mpfr_set_si (x, -1) fails\n"); + exit (1); + } + + mpfr_set_emax (5); + mpfr_set_prec (x, 2); + mpfr_set_si (x, -31, GMP_RNDN); + if (mpfr_sgn (x) >= 0) + { + fprintf (stderr, "mpfr_set_si (x, -31) fails\n"); + exit (1); + } + if ( + mpfr_clear(x); return 0; |