summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-06-05 16:50:17 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-06-05 16:50:17 +0000
commit76cab3b81c4506e171536b1d52c99f834e8a502a (patch)
treed9a306dcc3f5bdad2665bfc1a36f447d56461050
parent6641ec09b100b9d145ec9581f915af63bccf3c65 (diff)
downloadmpfr-76cab3b81c4506e171536b1d52c99f834e8a502a.tar.gz
[src/mpf2mpfr.h] Fixed mpf_fits_s* and mpf_get_si macros.
[tests/mpf_compat.h] Added non-regression tests. (merged changesets r11565,11571 from the trunk, and did some changes in the inclusions of header files due to the use of MPFR_ASSERTN) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11579 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/mpf2mpfr.h8
-rw-r--r--tests/mpf_compat.h20
2 files changed, 16 insertions, 12 deletions
diff --git a/src/mpf2mpfr.h b/src/mpf2mpfr.h
index 2dc3a23ef..17b70fc95 100644
--- a/src/mpf2mpfr.h
+++ b/src/mpf2mpfr.h
@@ -93,15 +93,15 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#undef mpf_div_2exp
#define mpf_div_2exp(x,y,z) mpfr_div_2exp(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_fits_slong_p
-#define mpf_fits_slong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
+#define mpf_fits_slong_p(x) mpfr_fits_slong_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_ulong_p
#define mpf_fits_ulong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_sint_p
-#define mpf_fits_sint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
+#define mpf_fits_sint_p(x) mpfr_fits_sint_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_uint_p
#define mpf_fits_uint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_sshort_p
-#define mpf_fits_sshort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
+#define mpf_fits_sshort_p(x) mpfr_fits_sshort_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_ushort_p
#define mpf_fits_ushort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
#undef mpf_get_str
@@ -113,7 +113,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#undef mpf_get_ui
#define mpf_get_ui(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
#undef mpf_get_si
-#define mpf_get_si(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
+#define mpf_get_si(x) mpfr_get_si(x,MPFR_DEFAULT_RND)
#undef mpf_inp_str
#define mpf_inp_str(x,y,z) mpfr_inp_str(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_set_str
diff --git a/tests/mpf_compat.h b/tests/mpf_compat.h
index eeeb0c069..86604eab6 100644
--- a/tests/mpf_compat.h
+++ b/tests/mpf_compat.h
@@ -20,16 +20,10 @@ along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#if defined (__cplusplus)
-#include <cstdio>
-#else
-#include <stdio.h>
-#endif
#include <stdlib.h>
-#include <string.h>
-#include "gmp.h"
-#include "mpfr.h"
+#include "mpfr-impl.h"
+
#ifdef MPFR
#include "mpf2mpfr.h"
#endif
@@ -228,6 +222,16 @@ main (void)
exit (1);
}
+ /* non-regression tests for bugs fixed in revision 11565 */
+ mpf_set_si (x, -1);
+ MPFR_ASSERTN(mpf_fits_ulong_p (x) == 0);
+ MPFR_ASSERTN(mpf_fits_slong_p (x) != 0);
+ MPFR_ASSERTN(mpf_fits_uint_p (x) == 0);
+ MPFR_ASSERTN(mpf_fits_sint_p (x) != 0);
+ MPFR_ASSERTN(mpf_fits_ushort_p (x) == 0);
+ MPFR_ASSERTN(mpf_fits_sshort_p (x) != 0);
+ MPFR_ASSERTN(mpf_get_si (x) == -1);
+
/* clear all variables */
mpf_clear (y);
mpf_clear (x);