diff options
author | Jay Belanger <[email protected]> | 2007-07-07 23:56:33 +0000 |
---|---|---|
committer | Jay Belanger <[email protected]> | 2007-07-07 23:56:33 +0000 |
commit | aefad52dcdaea3598788a42674dbc025cf12b3dc (patch) | |
tree | f4ac05711472c995ac377ed95d9c3ecfeeb7604b /lisp/calc | |
parent | cd42ec7d9b0d8538a4b7339e57d794f897a77b0a (diff) |
(math-bignum-digit-length): Change to optimal value.
(math-read-number-simple): Remove leading 0s.
Diffstat (limited to 'lisp/calc')
-rw-r--r-- | lisp/calc/calc.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 922a7c8d7f..48a1f915aa 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -2283,7 +2283,8 @@ See calc-keypad for details." -(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 @@ and all digits are kept, regardless of Calc's current precision." (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)))) |