summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-math.el
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2007-06-24 19:46:53 +0000
committerJay Belanger <jay.p.belanger@gmail.com>2007-06-24 19:46:53 +0000
commit98888d774f42158d05d040bf72ef67d86e75664c (patch)
tree4f118e9fe959962aa80c13cdfeaaf86aae2d18c5 /lisp/calc/calc-math.el
parentf164b8c846f0e77b1604b26adb3e3824cdd1c701 (diff)
downloademacs-98888d774f42158d05d040bf72ef67d86e75664c.tar.gz
(math-scale-bignum-digit-size): Renamed from math-scale-bignum-3.
(math-isqrt-bignum): Use math-scale-bignum-digit-size and math-bignum-digit-size. (math-isqrt-small): Add another possible initial guess.
Diffstat (limited to 'lisp/calc/calc-math.el')
-rw-r--r--lisp/calc/calc-math.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/calc/calc-math.el b/lisp/calc/calc-math.el
index 610ed304106..6ee7a49feab 100644
--- a/lisp/calc/calc-math.el
+++ b/lisp/calc/calc-math.el
@@ -310,15 +310,15 @@
(let* ((top (nthcdr (- len 2) a)))
(math-isqrt-bignum-iter
a
- (math-scale-bignum-3
+ (math-scale-bignum-digit-size
(math-bignum-big
(1+ (math-isqrt-small
- (+ (* (nth 1 top) 1000) (car top)))))
+ (+ (* (nth 1 top) math-bignum-digit-size) (car top)))))
(1- (/ len 2)))))
(let* ((top (nth (1- len) a)))
(math-isqrt-bignum-iter
a
- (math-scale-bignum-3
+ (math-scale-bignum-digit-size
(list (1+ (math-isqrt-small top)))
(/ len 2)))))))
@@ -341,14 +341,15 @@
(while (eq (car (setq a (cdr a))) 0))
(null a))))
-(defun math-scale-bignum-3 (a n) ; [L L S]
+(defun math-scale-bignum-digit-size (a n) ; [L L S]
(while (> n 0)
(setq a (cons 0 a)
n (1- n)))
a)
(defun math-isqrt-small (a) ; A > 0. [S S]
- (let ((g (cond ((>= a 10000) 1000)
+ (let ((g (cond ((>= a 1000000) 10000)
+ ((>= a 10000) 1000)
((>= a 100) 100)
(t 10)))
g2)