]> code.delx.au - gnu-emacs/blobdiff - lisp/calc/calc-comb.el
Merge from emacs--rel--22
[gnu-emacs] / lisp / calc / calc-comb.el
index ede04fd50327162ab62dca00decafa2c7dfc1f1d..6c3312ad13f7cabd03bb6bb5322f872485e8569a 100644 (file)
@@ -1,7 +1,7 @@
 ;;; calc-comb.el --- combinatoric functions for Calc
 
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;;; Factorial and related functions.
 
 (defconst math-small-factorial-table
-  (eval-when-compile
-    (vector 1 1 2 6 24 120 720 5040 40320 362880 
-            (math-read-number-simple "3628800")
-            (math-read-number-simple "39916800")
-            (math-read-number-simple "479001600")
-            (math-read-number-simple "6227020800")
-            (math-read-number-simple "87178291200")
-            (math-read-number-simple "1307674368000")
-            (math-read-number-simple "20922789888000")
-            (math-read-number-simple "355687428096000")
-            (math-read-number-simple "6402373705728000")
-            (math-read-number-simple "121645100408832000")
-            (math-read-number-simple "2432902008176640000"))))
+  (vector 1 1 2 6 24 120 720 5040 40320 362880 3628800 39916800
+          (math-read-number-simple "479001600")
+          (math-read-number-simple "6227020800")
+          (math-read-number-simple "87178291200")
+          (math-read-number-simple "1307674368000")
+          (math-read-number-simple "20922789888000")
+          (math-read-number-simple "355687428096000")
+          (math-read-number-simple "6402373705728000")
+          (math-read-number-simple "121645100408832000")
+          (math-read-number-simple "2432902008176640000")))
 
 (defun calcFunc-fact (n)   ; [I I] [F F] [Public]
   (let (temp)
          nil
        (if (Math-integerp var-RandSeed)
            (let* ((seed (math-sub 161803 var-RandSeed))
-                  (mj (1+ (math-mod seed 
-                                     (eval-when-compile
-                                       (math-read-number-simple "1000000")))))
-                  (mk (1+ (math-mod (math-quotient 
-                                      seed 
-                                      (eval-when-compile
-                                        (math-read-number-simple "1000000")))
-                                     (eval-when-compile 
-                                       (math-read-number-simple "1000000")))))
+                  (mj (1+ (math-mod seed 1000000)))
+                  (mk (1+ (math-mod (math-quotient seed 1000000)
+                                     1000000)))
                   (i 0))
              (setq math-random-table (cons 'vec (make-list 55 mj)))
              (while (<= (setq i (1+ i)) 54)
                   (error "Argument must be an integer"))
                  ((Math-integer-negp n)
                   '(nil))
-                 ((Math-natnum-lessp n 
-                                      (eval-when-compile
-                                        (math-read-number-simple "8000000")))
+                 ((Math-natnum-lessp n 8000000)
                   (setq n (math-fixnum n))
                   (let ((i -1) v)
                     (while (and (> (% n (setq v (aref math-primes-table
                                            (+
                                             sum
                                             (calcFunc-mod 
-                                             q 
-                                             (eval-when-compile
-                                               (math-read-number-simple
-                                                "1000000"))))
+                                             q 1000000))
                                            111111))
                                 (setq q 
                                       (math-quotient 
-                                       q 
-                                       (eval-when-compile
-                                         (math-read-number-simple
-                                          "1000000")))))
+                                       q 1000000)))
                              (cond ((= (% sum 3) 0) '(nil 3))
                                    ((= (% sum 7) 0) '(nil 7))
                                    ((= (% sum 11) 0) '(nil 11))
 
 (provide 'calc-comb)
 
-;;; arch-tag: 1d75ee9b-0815-42bd-a321-bb3dc001cc02
+;; arch-tag: 1d75ee9b-0815-42bd-a321-bb3dc001cc02
 ;;; calc-comb.el ends here