# HG changeset patch # User Jay Belanger # Date 1183852593 0 # Node ID d40120fec750fef03dee0dbbfb2aeb4ea7c8b258 # Parent 8c6a9f107a7ec555c4e0ff88973ae365f5cd4afd (math-bignum-digit-length): Change to optimal value. (math-read-number-simple): Remove leading 0s. diff -r 8c6a9f107a7e -r d40120fec750 lisp/calc/calc.el --- a/lisp/calc/calc.el Sat Jul 07 20:46:39 2007 +0000 +++ b/lisp/calc/calc.el Sat Jul 07 23:56:33 2007 +0000 @@ -2283,7 +2283,8 @@ -(defconst math-bignum-digit-length 3 +(defconst math-bignum-digit-length + (truncate (/ (log10 (/ most-positive-fixnum 2)) 2)) "The length of a \"digit\" in Calc bignums. If a big integer is of the form (bigpos N0 N1 ...), this is the length of the allowable Emacs integers N0, N1,... @@ -3466,6 +3467,8 @@ (cond ;; Integer ((string-match "^[0-9]+$" s) + (if (string-match "^\\(0+\\)" s) + (setq s (substring s (match-end 0)))) (if (<= (length s) (* 2 math-bignum-digit-length)) (string-to-number s) (cons 'bigpos (math-read-bignum s))))