aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2007-06-24 19:46:53 +0000
committerJay Belanger2007-06-24 19:46:53 +0000
commit98888d774f42158d05d040bf72ef67d86e75664c (patch)
tree4f118e9fe959962aa80c13cdfeaaf86aae2d18c5
parentf164b8c846f0e77b1604b26adb3e3824cdd1c701 (diff)
downloademacs-98888d774f42158d05d040bf72ef67d86e75664c.tar.gz
emacs-98888d774f42158d05d040bf72ef67d86e75664c.zip
(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.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/calc/calc-math.el11
2 files changed, 14 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a59c7d623b4..f27fa90ec25 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -4,6 +4,14 @@
4 Use math-read-number-simple to insert constants. 4 Use math-read-number-simple to insert constants.
5 (math-prime-test): Redo calculation of sum. 5 (math-prime-test): Redo calculation of sum.
6 6
7 * calc/calc-misc.el (math-div2-bignum): Use math-bignum-digit-size.
8
9 * calc/calc-math.el (math-scale-bignum-digit-size): Renamed from
10 math-scale-bignum-3.
11 (math-isqrt-bignum): Use math-scale-bignum-digit-size and
12 math-bignum-digit-size.
13 (math-isqrt-small): Add another possible initial guess.
14
72007-06-23 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> 152007-06-23 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
8 16
9 * textmodes/bibtex.el (bibtex-entry-format): New options 17 * textmodes/bibtex.el (bibtex-entry-format): New options
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 @@
310 (let* ((top (nthcdr (- len 2) a))) 310 (let* ((top (nthcdr (- len 2) a)))
311 (math-isqrt-bignum-iter 311 (math-isqrt-bignum-iter
312 a 312 a
313 (math-scale-bignum-3 313 (math-scale-bignum-digit-size
314 (math-bignum-big 314 (math-bignum-big
315 (1+ (math-isqrt-small 315 (1+ (math-isqrt-small
316 (+ (* (nth 1 top) 1000) (car top))))) 316 (+ (* (nth 1 top) math-bignum-digit-size) (car top)))))
317 (1- (/ len 2))))) 317 (1- (/ len 2)))))
318 (let* ((top (nth (1- len) a))) 318 (let* ((top (nth (1- len) a)))
319 (math-isqrt-bignum-iter 319 (math-isqrt-bignum-iter
320 a 320 a
321 (math-scale-bignum-3 321 (math-scale-bignum-digit-size
322 (list (1+ (math-isqrt-small top))) 322 (list (1+ (math-isqrt-small top)))
323 (/ len 2))))))) 323 (/ len 2)))))))
324 324
@@ -341,14 +341,15 @@
341 (while (eq (car (setq a (cdr a))) 0)) 341 (while (eq (car (setq a (cdr a))) 0))
342 (null a)))) 342 (null a))))
343 343
344(defun math-scale-bignum-3 (a n) ; [L L S] 344(defun math-scale-bignum-digit-size (a n) ; [L L S]
345 (while (> n 0) 345 (while (> n 0)
346 (setq a (cons 0 a) 346 (setq a (cons 0 a)
347 n (1- n))) 347 n (1- n)))
348 a) 348 a)
349 349
350(defun math-isqrt-small (a) ; A > 0. [S S] 350(defun math-isqrt-small (a) ; A > 0. [S S]
351 (let ((g (cond ((>= a 10000) 1000) 351 (let ((g (cond ((>= a 1000000) 10000)
352 ((>= a 10000) 1000)
352 ((>= a 100) 100) 353 ((>= a 100) 100)
353 (t 10))) 354 (t 10)))
354 g2) 355 g2)