[Gmp-commit] /var/hg/gmp: 3 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Tue Mar 19 22:09:38 CET 2013
details: /var/hg/gmp/rev/760dc4f2c44b
changeset: 15614:760dc4f2c44b
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Tue Mar 19 22:06:09 2013 +0100
description:
mpf/fits_u.h: accept numbers truncating to zero before checking the sign.
details: /var/hg/gmp/rev/1d2efa9f697b
changeset: 15615:1d2efa9f697b
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Tue Mar 19 22:07:18 2013 +0100
description:
tests/mpf/t-fits.c: Check new edges.
details: /var/hg/gmp/rev/30e04d203216
changeset: 15616:30e04d203216
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Tue Mar 19 22:09:30 2013 +0100
description:
ChangeLog
diffstat:
ChangeLog | 5 +++++
mpf/fits_u.h | 10 +++++-----
tests/mpf/t-fits.c | 11 ++++++++++-
3 files changed, 20 insertions(+), 6 deletions(-)
diffs (69 lines):
diff -r 69009e987422 -r 30e04d203216 ChangeLog
--- a/ChangeLog Tue Mar 19 18:44:35 2013 +0100
+++ b/ChangeLog Tue Mar 19 22:09:30 2013 +0100
@@ -1,3 +1,8 @@
+2013-03-19 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+ * mpf/fits_u.h: accept numbers truncating to zero before checking the sign.
+ * tests/mpf/t-fits.c: Check new edges.
+
2013-03-19 Torbjorn Granlund <tege at gmplib.org>
* tests/arm32check.c: Get printing of clobbered register right.
diff -r 69009e987422 -r 30e04d203216 mpf/fits_u.h
--- a/mpf/fits_u.h Tue Mar 19 18:44:35 2013 +0100
+++ b/mpf/fits_u.h Tue Mar 19 22:09:30 2013 +0100
@@ -1,6 +1,6 @@
/* mpf_fits_u*_p -- test whether an mpf fits a C unsigned type.
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,14 +31,14 @@
mp_exp_t exp;
mp_limb_t fl;
+ exp = EXP(f);
+ if (exp < 1)
+ return 1; /* -1 < f < 1 truncates to zero, so fits */
+
fn = SIZ(f);
if (fn <= 0)
return fn == 0; /* zero fits, negatives don't */
- exp = EXP(f);
- if (exp < 1)
- return 1; /* 0 < f < 1 truncates to zero, so fits */
-
fp = PTR(f);
if (exp == 1)
diff -r 69009e987422 -r 30e04d203216 tests/mpf/t-fits.c
--- a/tests/mpf/t-fits.c Tue Mar 19 18:44:35 2013 +0100
+++ b/tests/mpf/t-fits.c Tue Mar 19 22:09:30 2013 +0100
@@ -1,6 +1,6 @@
/* Test mpf_fits_*_p
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library test suite.
@@ -252,6 +252,15 @@
mpf_set_str_or_abort (f, "-0.5", 10);
expr = "-0.5";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+ EXPECT (mpf_fits_ushort_p, 1);
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_str_or_abort (f, "-1.5", 10);
+ expr = "-1.5";
EXPECT (mpf_fits_ulong_p, 0);
EXPECT (mpf_fits_uint_p, 0);
EXPECT (mpf_fits_ushort_p, 0);
More information about the gmp-commit
mailing list