[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/calc/calc.el,v
From: |
Jay Belanger |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/calc/calc.el,v |
Date: |
Sat, 07 Jul 2007 04:13:49 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Jay Belanger <jpb> 07/07/07 04:13:49
Index: calc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calc/calc.el,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- calc.el 6 Jul 2007 03:56:12 -0000 1.82
+++ calc.el 7 Jul 2007 04:13:49 -0000 1.83
@@ -3401,6 +3401,7 @@
;;; Parse a simple number in string form. [N X] [Public]
(defun math-read-number (s)
+ "Convert the string S into a Calc number."
(math-normalize
(cond
@@ -3411,7 +3412,7 @@
(> (length digs) 1)
(eq (aref digs 0) ?0))
(math-read-number (concat "8#" digs))
- (if (<= (length digs) 6)
+ (if (<= (length digs) (* 2 math-bignum-digit-length))
(string-to-number digs)
(cons 'bigpos (math-read-bignum digs))))))
@@ -3459,13 +3460,20 @@
;;; Parse a very simple number, keeping all digits.
(defun math-read-number-simple (s)
+ "Convert the string S into a Calc number.
+S is assumed to be a simple number (integer or float without an exponent)
+and all digits are kept, regardless of Calc's current precision."
(cond
;; Integer
((string-match "^[0-9]+$" s)
- (cons 'bigpos (math-read-bignum s)))
+ (if (<= (length s) (* 2 math-bignum-digit-length))
+ (string-to-number s)
+ (cons 'bigpos (math-read-bignum s))))
;; Minus sign
((string-match "^-[0-9]+$" s)
- (cons 'bigneg (math-read-bignum (substring s 1))))
+ (if (<= (length s) (1+ (* 2 math-bignum-digit-length)))
+ (string-to-number s)
+ (cons 'bigneg (math-read-bignum (substring s 1)))))
;; Decimal point
((string-match "^\\(-?[0-9]*\\)\\.\\([0-9]*\\)$" s)
(let ((int (math-match-substring s 1))
- [Emacs-diffs] Changes to emacs/lisp/calc/calc.el,v, Jay Belanger, 2007/07/05
- [Emacs-diffs] Changes to emacs/lisp/calc/calc.el,v,
Jay Belanger <=
- [Emacs-diffs] Changes to emacs/lisp/calc/calc.el,v, Jay Belanger, 2007/07/07
- [Emacs-diffs] Changes to emacs/lisp/calc/calc.el,v, Jay Belanger, 2007/07/07
- [Emacs-diffs] Changes to emacs/lisp/calc/calc.el,v, Jay Belanger, 2007/07/07
- [Emacs-diffs] Changes to emacs/lisp/calc/calc.el,v, Jay Belanger, 2007/07/07
- [Emacs-diffs] Changes to emacs/lisp/calc/calc.el,v, Miles Bader, 2007/07/26