| |
@@ -1,96 +0,0 @@
|
| |
- --- japron/gmp/gmp_Mpfr.c.orig 2013-07-05 16:16:16.000000000 -0600
|
| |
- +++ japron/gmp/gmp_Mpfr.c 2019-07-17 16:02:33.642733801 -0600
|
| |
- @@ -824,10 +824,23 @@ JNIEXPORT jint JNICALL Java_gmp_Mpfr_cbr
|
| |
- JNIEXPORT jint JNICALL Java_gmp_Mpfr_root
|
| |
- (JNIEnv *env, jobject o1, jobject o2, jint i, jint p)
|
| |
- {
|
| |
- +#if MPFR_VERSION_MAJOR >= 4
|
| |
- + mpfr_ptr mpfr1, mpfr2;
|
| |
- +#endif
|
| |
- check_nonnull(o1,0);
|
| |
- check_nonnull(o2,0);
|
| |
- check_positive(i,0);
|
| |
- +#if MPFR_VERSION_MAJOR >= 4
|
| |
- + mpfr1 = as_mpfr(o1);
|
| |
- + mpfr2 = as_mpfr(o2);
|
| |
- + if (mpfr_zero_p(mpfr2)) {
|
| |
- + mpfr_set_zero(mpfr1, mpfr_sgn(mpfr2));
|
| |
- + return 0;
|
| |
- + }
|
| |
- + return mpfr_rootn_ui(mpfr1, mpfr2, i, p);
|
| |
- +#else
|
| |
- return mpfr_root(as_mpfr(o1), as_mpfr(o2), i, p);
|
| |
- +#endif
|
| |
- }
|
| |
-
|
| |
- /*
|
| |
- --- num/numflt_mpfr.h.orig 2015-12-11 02:59:58.000000000 -0700
|
| |
- +++ num/numflt_mpfr.h 2019-07-17 16:04:45.307464218 -0600
|
| |
- @@ -123,8 +123,18 @@ static inline void numflt_root(numflt_t
|
| |
- {
|
| |
- assert(n > 0);
|
| |
- assert((n & 1) || (mpfr_sgn(b) >= 0));
|
| |
- +#if MPFR_VERSION_MAJOR >= 4
|
| |
- + if (mpfr_zero_p(b)) {
|
| |
- + mpfr_set_zero(up, mpfr_sgn(b));
|
| |
- + mpfr_set_zero(down, mpfr_sgn(b));
|
| |
- + } else {
|
| |
- + mpfr_rootn_ui(up, b, n, GMP_RNDU);
|
| |
- + mpfr_rootn_ui(down, b, n, GMP_RNDD);
|
| |
- + }
|
| |
- +#else
|
| |
- mpfr_root(up, b, n, GMP_RNDU);
|
| |
- mpfr_root(down, b, n, GMP_RNDD);
|
| |
- +#endif
|
| |
- }
|
| |
- static inline void numflt_mul_2exp(numflt_t a, numflt_t b, int c)
|
| |
- { mpfr_mul_2si(a,b,c,GMP_RNDU); }
|
| |
- --- num/numflt_native.h.orig 2015-05-18 08:17:02.000000000 -0600
|
| |
- +++ num/numflt_native.h 2019-07-17 16:04:02.792197087 -0600
|
| |
- @@ -188,18 +188,46 @@ static inline void numflt_root(numflt_t
|
| |
- #if defined(NUMFLT_DOUBLE)
|
| |
- mpfr_init_set_d(arg, *b, GMP_RNDU);
|
| |
- mpfr_init(res);
|
| |
- +#if MPFR_VERSION_MAJOR >= 4
|
| |
- + if (mpfr_zero_p(arg))
|
| |
- + mpfr_set_zero(res, mpfr_sgn(arg));
|
| |
- + else
|
| |
- + mpfr_rootn_ui(res, arg, n, GMP_RNDU);
|
| |
- +#else
|
| |
- mpfr_root(res, arg, n, GMP_RNDU);
|
| |
- +#endif
|
| |
- *up = mpfr_get_d(res, GMP_RNDU);
|
| |
- mpfr_set_d(arg, *b, GMP_RNDD);
|
| |
- +#if MPFR_VERSION_MAJOR >= 4
|
| |
- + if (mpfr_zero_p(arg))
|
| |
- + mpfr_set_zero(res, mpfr_sgn(arg));
|
| |
- + else
|
| |
- + mpfr_rootn_ui(res, arg, n, GMP_RNDD);
|
| |
- +#else
|
| |
- mpfr_root(res, arg, n, GMP_RNDD);
|
| |
- +#endif
|
| |
- *down = mpfr_get_d(res, GMP_RNDD);
|
| |
- #else
|
| |
- mpfr_init_set_ld(arg, *b, GMP_RNDU);
|
| |
- mpfr_init(res);
|
| |
- +#if MPFR_VERSION_MAJOR >= 4
|
| |
- + if (mpfr_zero_p(arg))
|
| |
- + mpfr_set_zero(res, mpfr_sgn(arg));
|
| |
- + else
|
| |
- + mpfr_rootn_ui(res, arg, n, GMP_RNDU);
|
| |
- +#else
|
| |
- mpfr_root(res, arg, n, GMP_RNDU);
|
| |
- +#endif
|
| |
- *up = mpfr_get_ld(res, GMP_RNDU);
|
| |
- mpfr_set_ld(arg, *b, GMP_RNDD);
|
| |
- +#if MPFR_VERSION_MAJOR >= 4
|
| |
- + if (mpfr_zero_p(arg))
|
| |
- + mpfr_set_zero(res, mpfr_sgn(arg));
|
| |
- + else
|
| |
- + mpfr_rootn_ui(res, arg, n, GMP_RNDD);
|
| |
- +#else
|
| |
- mpfr_root(res, arg, n, GMP_RNDD);
|
| |
- +#endif
|
| |
- *down = mpfr_get_ld(res, GMP_RNDD);
|
| |
- #endif
|
| |
- mpfr_clear(arg);
|
| |
I have dropped both patches, as they don't appear to be necessary, but I am actually not sure about the mpfr patch (although apron builds without it and the tests pass).