Mercurial > emacs
changeset 81741:d40120fec750
(math-bignum-digit-length): Change to optimal value.
(math-read-number-simple): Remove leading 0s.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Sat, 07 Jul 2007 23:56:33 +0000 |
parents | 8c6a9f107a7e |
children | 3340bf730dea |
files | lisp/calc/calc.el |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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))))