* calc/calc-comb.el (math-prime-test): Don't assume large integers are
authorJay Belanger <jay.p.belanger@gmail.com>
Thu, 17 Oct 2013 03:37:05 +0000 (22:37 -0500)
committerJay Belanger <jay.p.belanger@gmail.com>
Thu, 17 Oct 2013 03:37:05 +0000 (22:37 -0500)
  represented by lists.

* doc/misc/calc.el (Data Type Formats): Don't specify the size at
  which integers begin to be represented by lists.

doc/misc/ChangeLog
doc/misc/calc.texi
lisp/ChangeLog
lisp/calc/calc-comb.el

index a05a9f6..76d3954 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-17  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc.el (Data Type Formats): Don't specify the size at
+       which integers begin to be represented by lists.
+
 2013-10-14  Xue Fuqiao  <xfq.free@gmail.com>
 
        * cl.texi (Argument Lists): Add indexes for &key and &aux.
index b2b054e..04160ea 100644 (file)
@@ -33306,12 +33306,15 @@ Lisp integers.  This is the only storage format for Calc data objects
 which is not a Lisp list.
 
 Large integers are stored as lists of the form @samp{(bigpos @var{d0}
-@var{d1} @var{d2} @dots{})} for positive integers 1000000 or more, or
-@samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative integers
-@mathit{-1000000} or less.  Each @var{d} is a base-1000 ``digit,'' a Lisp integer
-from 0 to 999.  The least significant digit is @var{d0}; the last digit,
+@var{d1} @var{d2} @dots{})} for sufficiently large positive integers
+(where ``sufficiently large'' depends on the machine), or
+@samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative
+integers.  Each @var{d} is a base-@expr{10^n} ``digit'' (where again,
+@expr{n} depends on the machine), a Lisp integer from 0 to
+99@dots{}9.  The least significant digit is @var{d0}; the last digit,
 @var{dn}, which is always nonzero, is the most significant digit.  For
-example, the integer @mathit{-12345678} is stored as @samp{(bigneg 678 345 12)}.
+example, the integer @mathit{-12345678} might be stored as
+@samp{(bigneg 678 345 12)}. 
 
 The distinction between small and large integers is entirely hidden from
 the user.  In @code{defmath} definitions, the Lisp predicate @code{integerp}
index 914826d..542a910 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-17  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-comb.el (math-prime-test): Don't assume large integers are
+       represented by lists.
+
 2013-10-16  Glenn Morris  <rgm@gnu.org>
 
        * tmm.el (tmm--history): New dynamic variable.
index e09bef0..1a2d609 100644 (file)
                         (list nil v)
                       '(t))))
                  ((not (equal n (car math-prime-test-cache)))
-                  (cond ((= (% (nth 1 n) 2) 0) '(nil 2))
-                        ((= (% (nth 1 n) 5) 0) '(nil 5))
+                  (cond ((if (consp n)
+                              (= (% (nth 1 n) 2) 0)
+                            (= (% n 2) 0))
+                          '(nil 2))
+                        ((if (consp n)
+                              (= (% (nth 1 n) 5) 0)
+                            (= (% n 5) 0))
+                          '(nil 5))
                         (t (let ((q n) (sum 0))
                               (while (not (eq q 0))
                                 (setq sum (%