]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/hideif.el (hif-string-to-number): Don't return float for
authorWilliam Xu <william.xwl@gmail.com>
Thu, 19 Jun 2014 21:08:44 +0000 (17:08 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 19 Jun 2014 21:08:44 +0000 (17:08 -0400)
hex integer constants.

Fixes: debbugs:17807
lisp/ChangeLog
lisp/progmodes/hideif.el

index 1bc768a3b52405dd6f348e93a8b56a781e6f1525..d8146a96312ad3ea38d63cb08d0c93242d7db5c7 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-19  William Xu  <william.xwl@gmail.com>
+
+       * progmodes/hideif.el (hif-string-to-number): Don't return float for
+       hex integer constants (bug#17807).
+
 2014-06-19  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * international/mule-util.el (truncate-string-ellipsis): New var.
index bcb465924656450800f55b770091cfae1c16001e..ee144df4395b28d261228f553835f50427c7247f 100644 (file)
@@ -412,9 +412,13 @@ that form should be displayed.")
   (if (or (not base) (= base 10))
       (string-to-number string base)
     (let* ((parts (split-string string "\\." t "[ \t]+"))
-          (frac (cadr parts))
-          (quot (expt (* base 1.0) (length frac))))
-      (/ (string-to-number (concat (car parts) frac) base) quot))))
+           (frac (cadr parts))
+           (quot (expt (* base 1.0) (length frac)))
+           (num (/ (string-to-number (concat (car parts) frac) base)
+                   quot)))
+      (if (= num (truncate num))
+          (truncate num)
+        num))))
 
 (defun hif-tokenize (start end)
   "Separate string between START and END into a list of tokens."