27 lines
722 B
Diff
27 lines
722 B
Diff
--- japron/gmp/gmp_Mpfr.c.orig 2019-11-10 07:33:31.000000000 -0700
|
|
+++ japron/gmp/gmp_Mpfr.c 2020-01-17 09:08:16.852531901 -0700
|
|
@@ -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
|
|
}
|
|
|
|
/*
|