summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sci-mathematics/fricas/files/fricas-sbcl-2.3.9.patch')
-rw-r--r--sci-mathematics/fricas/files/fricas-sbcl-2.3.9.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/sci-mathematics/fricas/files/fricas-sbcl-2.3.9.patch b/sci-mathematics/fricas/files/fricas-sbcl-2.3.9.patch
new file mode 100644
index 000000000000..6f7440afecf5
--- /dev/null
+++ b/sci-mathematics/fricas/files/fricas-sbcl-2.3.9.patch
@@ -0,0 +1,61 @@
+diff --git a/src/lisp/num_gmp.lisp b/src/lisp/num_gmp.lisp
+index b58001e..9538e3c 100644
+--- a/src/lisp/num_gmp.lisp
++++ b/src/lisp/num_gmp.lisp
+@@ -549,6 +549,20 @@
+ ;;; (gmp-bignum-isqrt (expt 10 50))
+ ;;; (gmp-bignum-isqrt (expt 2 127))
+ #+:sbcl
++
++(defmacro negate_bignum(x)
++ (let ((sym2
++ (find-symbol "NEGATE-BIGNUM-NOT-FULLY-NORMALIZED" "SB-BIGNUM")))
++ (if sym2
++ `(,sym2 ,x)
++ ;;; 'read-from-string' looks silly, but here we want error
++ ;;; if NEGATE-BIGNUM is absent from SB-BIGNUM
++ (let ((sym1 (read-from-string "SB-BIGNUM::NEGATE-BIGNUM")))
++ `(,sym1 ,x nil))
++ )
++ )
++)
++
+ (defun gmp-bignum-isqrt (x)
+ (let* ((len-x (sb-bignum::%bignum-length x))
+ (len-res (ceiling (+ 1 len-x) 2))
+@@ -652,8 +666,8 @@
+ (sb-bignum::%bignum-length a)))
+ (b-plusp (sb-bignum::%bignum-0-or-plusp b
+ (sb-bignum::%bignum-length b)))
+- (a (if a-plusp a (sb-bignum::negate-bignum a)))
+- (b (if b-plusp b (sb-bignum::negate-bignum b)))
++ (a (if a-plusp a (negate_bignum a)))
++ (b (if b-plusp b (negate_bignum b)))
+ (len-a (sb-bignum::%bignum-length a))
+ (len-b (sb-bignum::%bignum-length b))
+ (len-res (+ len-a len-b))
+@@ -697,10 +711,10 @@
+ (let* (
+ (nx (if (sb-bignum::%bignum-0-or-plusp x (sb-bignum::%bignum-length x))
+ (sb-bignum::copy-bignum x)
+- (sb-bignum::negate-bignum x nil)))
++ (negate_bignum x)))
+ (ny (if (sb-bignum::%bignum-0-or-plusp y (sb-bignum::%bignum-length y))
+ (sb-bignum::copy-bignum y)
+- (sb-bignum::negate-bignum y nil)))
++ (negate_bignum y)))
+ (xl (sb-bignum::%bignum-length nx))
+ (yl (sb-bignum::%bignum-length ny))
+ (rl (if (< xl yl) xl yl))
+@@ -735,9 +749,9 @@
+ (x-plusp (sb-bignum::%bignum-0-or-plusp x (sb-bignum::%bignum-length x)))
+ (y-plusp (sb-bignum::%bignum-0-or-plusp y (sb-bignum::%bignum-length y)))
+ (nx (if x-plusp x
+- (sb-bignum::negate-bignum x nil)))
++ (negate_bignum x)))
+ (ny (if y-plusp y
+- (sb-bignum::negate-bignum y nil)))
++ (negate_bignum y)))
+ (len-x (sb-bignum::%bignum-length nx))
+ (len-y (sb-bignum::%bignum-length ny))
+ (q nil)