crosstool-ng/patches/mpfr/3.1.3/250-agm-eq.patch

106 lines
3.1 KiB
Diff
Raw Normal View History

diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
--- mpfr-3.1.3-a/PATCHES 2016-02-23 07:55:17.208593082 +0000
+++ mpfr-3.1.3-b/PATCHES 2016-02-23 07:55:17.232592762 +0000
@@ -0,0 +1 @@
+agm-eq
diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
--- mpfr-3.1.3-a/VERSION 2016-02-23 07:54:06.641532898 +0000
+++ mpfr-3.1.3-b/VERSION 2016-02-23 07:55:17.232592762 +0000
@@ -1 +1 @@
-3.1.3-p14
+3.1.3-p15
diff -Naurd mpfr-3.1.3-a/src/agm.c mpfr-3.1.3-b/src/agm.c
--- mpfr-3.1.3-a/src/agm.c 2015-06-19 19:55:10.000000000 +0000
+++ mpfr-3.1.3-b/src/agm.c 2016-02-23 07:55:17.224592868 +0000
@@ -96,10 +96,7 @@
/* b (op2) and a (op1) are the 2 operands but we want b >= a */
compare = mpfr_cmp (op1, op2);
if (MPFR_UNLIKELY( compare == 0 ))
- {
- mpfr_set (r, op1, rnd_mode);
- MPFR_RET (0); /* exact */
- }
+ return mpfr_set (r, op1, rnd_mode);
else if (compare > 0)
{
mpfr_srcptr t = op1;
diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
--- mpfr-3.1.3-a/src/mpfr.h 2016-02-23 07:54:06.641532898 +0000
+++ mpfr-3.1.3-b/src/mpfr.h 2016-02-23 07:55:17.232592762 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 3
-#define MPFR_VERSION_STRING "3.1.3-p14"
+#define MPFR_VERSION_STRING "3.1.3-p15"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
--- mpfr-3.1.3-a/src/version.c 2016-02-23 07:54:06.641532898 +0000
+++ mpfr-3.1.3-b/src/version.c 2016-02-23 07:55:17.232592762 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.3-p14";
+ return "3.1.3-p15";
}
diff -Naurd mpfr-3.1.3-a/tests/tagm.c mpfr-3.1.3-b/tests/tagm.c
--- mpfr-3.1.3-a/tests/tagm.c 2015-06-19 19:55:10.000000000 +0000
+++ mpfr-3.1.3-b/tests/tagm.c 2016-02-23 07:55:17.224592868 +0000
@@ -169,6 +169,45 @@
}
static void
+check_eq (void)
+{
+ mpfr_t a, b, agm;
+ int p;
+
+ mpfr_init2 (a, 17);
+ mpfr_init2 (b, 9);
+
+ mpfr_set_str_binary (b, "0.101000000E-3");
+ mpfr_set (a, b, MPFR_RNDN);
+
+ for (p = MPFR_PREC_MIN; p <= 2; p++)
+ {
+ int inex;
+
+ mpfr_init2 (agm, p);
+ inex = mpfr_agm (agm, a, b, MPFR_RNDU);
+ if (mpfr_cmp_ui_2exp (agm, 5 - p, -5) != 0)
+ {
+ printf ("Error in check_eq for p = %d: expected %d*2^(-5), got ",
+ p, 5 - p);
+ mpfr_dump (agm);
+ exit (1);
+ }
+ if (inex <= 0)
+ {
+ printf ("Wrong ternary value in check_eq for p = %d\n", p);
+ printf ("expected 1\n");
+ printf ("got %d\n", inex);
+ exit (1);
+ }
+ mpfr_clear (agm);
+ }
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+}
+
+static void
check_nans (void)
{
mpfr_t x, y, m;
@@ -260,6 +299,7 @@
check_nans ();
check_large ();
+ check_eq ();
check4 ("2.0", "1.0", MPFR_RNDN, "1.456791031046906869", -1);
check4 ("6.0", "4.0", MPFR_RNDN, "4.949360872472608925", 1);
check4 ("62.0", "61.0", MPFR_RNDN, "61.498983718845075902", -1);