Function: math-read-number-simple
math-read-number-simple is a byte-compiled function defined in
calc.el.gz.
Signature
(math-read-number-simple S)
Documentation
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.
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc.el.gz
;;; 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."
(save-match-data
(cond
;; Integer
((string-match "^[0-9]+$" s)
(if (string-match "^\\(0+\\)" s)
(setq s (substring s (match-end 0))))
(string-to-number s))
;; Minus sign
((string-match "^-[0-9]+$" s)
(string-to-number s))
;; Decimal point
((string-match "^\\(-?[0-9]*\\)\\.\\([0-9]*\\)$" s)
(let ((int (math-match-substring s 1))
(frac (math-match-substring s 2)))
(list 'float (math-read-number-simple (concat int frac))
(- (length frac)))))
;; Syntax error!
(t nil))))