emacs-diffs
[Top][All Lists]
Advanced

[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: Tue, 05 Aug 2008 03:38:25 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Jay Belanger <jpb>      08/08/05 03:38:25

Index: calc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calc/calc.el,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- calc.el     28 Jun 2008 14:14:29 -0000      1.112
+++ calc.el     5 Aug 2008 03:38:24 -0000       1.113
@@ -3455,7 +3455,7 @@
 
 
 ;;; Parse a simple number in string form.   [N X] [Public]
-(defun math-read-number (s)
+(defun math-read-number (s &optional decimal)
   "Convert the string S into a Calc number."
   (math-normalize
    (cond
@@ -3465,7 +3465,8 @@
      (let ((digs (math-match-substring s 1)))
        (if (and (eq calc-language 'c)
                (> (length digs) 1)
-               (eq (aref digs 0) ?0))
+               (eq (aref digs 0) ?0)
+                (null decimal))
           (math-read-number (concat "8#" digs))
         (if (<= (length digs) (* 2 math-bignum-digit-length))
             (string-to-number digs)
@@ -3492,8 +3493,8 @@
           (frac (math-match-substring s 2)))
        (let ((ilen (length int))
             (flen (length frac)))
-        (let ((int (if (> ilen 0) (math-read-number int) 0))
-              (frac (if (> flen 0) (math-read-number frac) 0)))
+        (let ((int (if (> ilen 0) (math-read-number int t) 0))
+              (frac (if (> flen 0) (math-read-number frac t) 0)))
           (and int frac (or (> ilen 0) (> flen 0))
                (list 'float
                      (math-add (math-scale-int int flen) frac)
@@ -3503,7 +3504,7 @@
     ((string-match "^\\(.*\\)[eE]\\([-+]?[0-9]+\\)$" s)
      (let ((mant (math-match-substring s 1))
           (exp (math-match-substring s 2)))
-       (let ((mant (if (> (length mant) 0) (math-read-number mant) 1))
+       (let ((mant (if (> (length mant) 0) (math-read-number mant t) 1))
             (exp (if (<= (length exp) (if (memq (aref exp 0) '(?+ ?-)) 8 7))
                      (string-to-number exp))))
         (and mant exp (Math-realp mant) (> exp -4000000) (< exp 4000000)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]