aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2013-10-16 22:37:05 -0500
committerJay Belanger2013-10-16 22:37:05 -0500
commitc8722a9799832942ff219f4ae881f44985c35924 (patch)
tree531d2d7e5bc2b815906b86d5aab50aee1f7ae6df
parentbb9937df2db9129cdc248532a93f406221a2f65c (diff)
downloademacs-c8722a9799832942ff219f4ae881f44985c35924.tar.gz
emacs-c8722a9799832942ff219f4ae881f44985c35924.zip
* calc/calc-comb.el (math-prime-test): Don't assume large integers are
represented by lists. * doc/misc/calc.el (Data Type Formats): Don't specify the size at which integers begin to be represented by lists.
-rw-r--r--doc/misc/ChangeLog5
-rw-r--r--doc/misc/calc.texi13
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/calc/calc-comb.el10
4 files changed, 26 insertions, 7 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index a05a9f67ac4..76d3954cfcf 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,8 @@
12013-10-17 Jay Belanger <jay.p.belanger@gmail.com>
2
3 * calc.el (Data Type Formats): Don't specify the size at
4 which integers begin to be represented by lists.
5
12013-10-14 Xue Fuqiao <xfq.free@gmail.com> 62013-10-14 Xue Fuqiao <xfq.free@gmail.com>
2 7
3 * cl.texi (Argument Lists): Add indexes for &key and &aux. 8 * cl.texi (Argument Lists): Add indexes for &key and &aux.
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index b2b054ec1ea..04160eafad0 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -33306,12 +33306,15 @@ Lisp integers. This is the only storage format for Calc data objects
33306which is not a Lisp list. 33306which is not a Lisp list.
33307 33307
33308Large integers are stored as lists of the form @samp{(bigpos @var{d0} 33308Large integers are stored as lists of the form @samp{(bigpos @var{d0}
33309@var{d1} @var{d2} @dots{})} for positive integers 1000000 or more, or 33309@var{d1} @var{d2} @dots{})} for sufficiently large positive integers
33310@samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative integers 33310(where ``sufficiently large'' depends on the machine), or
33311@mathit{-1000000} or less. Each @var{d} is a base-1000 ``digit,'' a Lisp integer 33311@samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative
33312from 0 to 999. The least significant digit is @var{d0}; the last digit, 33312integers. Each @var{d} is a base-@expr{10^n} ``digit'' (where again,
33313@expr{n} depends on the machine), a Lisp integer from 0 to
3331499@dots{}9. The least significant digit is @var{d0}; the last digit,
33313@var{dn}, which is always nonzero, is the most significant digit. For 33315@var{dn}, which is always nonzero, is the most significant digit. For
33314example, the integer @mathit{-12345678} is stored as @samp{(bigneg 678 345 12)}. 33316example, the integer @mathit{-12345678} might be stored as
33317@samp{(bigneg 678 345 12)}.
33315 33318
33316The distinction between small and large integers is entirely hidden from 33319The distinction between small and large integers is entirely hidden from
33317the user. In @code{defmath} definitions, the Lisp predicate @code{integerp} 33320the user. In @code{defmath} definitions, the Lisp predicate @code{integerp}
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 914826db0b5..542a9108d32 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12013-10-17 Jay Belanger <jay.p.belanger@gmail.com>
2
3 * calc/calc-comb.el (math-prime-test): Don't assume large integers are
4 represented by lists.
5
12013-10-16 Glenn Morris <rgm@gnu.org> 62013-10-16 Glenn Morris <rgm@gnu.org>
2 7
3 * tmm.el (tmm--history): New dynamic variable. 8 * tmm.el (tmm--history): New dynamic variable.
diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el
index e09bef0b5c9..1a2d6092196 100644
--- a/lisp/calc/calc-comb.el
+++ b/lisp/calc/calc-comb.el
@@ -815,8 +815,14 @@
815 (list nil v) 815 (list nil v)
816 '(t)))) 816 '(t))))
817 ((not (equal n (car math-prime-test-cache))) 817 ((not (equal n (car math-prime-test-cache)))
818 (cond ((= (% (nth 1 n) 2) 0) '(nil 2)) 818 (cond ((if (consp n)
819 ((= (% (nth 1 n) 5) 0) '(nil 5)) 819 (= (% (nth 1 n) 2) 0)
820 (= (% n 2) 0))
821 '(nil 2))
822 ((if (consp n)
823 (= (% (nth 1 n) 5) 0)
824 (= (% n 5) 0))
825 '(nil 5))
820 (t (let ((q n) (sum 0)) 826 (t (let ((q n) (sum 0))
821 (while (not (eq q 0)) 827 (while (not (eq q 0))
822 (setq sum (% 828 (setq sum (%