[slime-cvs] CVS slime

nsiivola nsiivola at common-lisp.net
Mon Feb 26 09:56:06 UTC 2007


Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv15154

Modified Files:
	ChangeLog swank.lisp 
Log Message:
inspecting NaNs and infinities

--- /project/slime/cvsroot/slime/ChangeLog	2007/02/25 18:22:42	1.1075
+++ /project/slime/cvsroot/slime/ChangeLog	2007/02/26 09:56:06	1.1076
@@ -1,3 +1,8 @@
+2007-02-26  Nikodemus Siivola <nikodemus at random-state.net>
+
+	* swank.lisp (inspect-for-emacs): Add support for inspecting
+	non-decodable float entities like NaNs and infinities.
+
 2007-02-25  Tobias C. Rittweiler <tcr at freebits.de>
 
 	* swank-backend.lisp (inspect-for-emacs): Remove reference to
--- /project/slime/cvsroot/slime/swank.lisp	2007/02/25 09:16:30	1.459
+++ /project/slime/cvsroot/slime/swank.lisp	2007/02/26 09:56:06	1.460
@@ -4807,16 +4807,24 @@
 
 (defmethod inspect-for-emacs ((f float) inspector)
   (declare (ignore inspector))
-  (multiple-value-bind (significand exponent sign) (decode-float f)
-    (values "A floating point number."
-            (append 
-             `("Scientific: " ,(format nil "~E" f) (:newline)
-               "Decoded: " 
-               (:value ,sign) " * " 
-               (:value ,significand) " * " 
-               (:value ,(float-radix f)) "^" (:value ,exponent) (:newline))
-             (label-value-line "Digits" (float-digits f))
-             (label-value-line "Precision" (float-precision f))))))
+  (values "A floating point number."
+          (cond
+            ((> f most-positive-long-float)
+             (list "Positive infinity."))
+            ((< f most-negative-long-float)
+             (list "Negative infinity."))
+            ((not (= f f))
+             (list "Not a Number."))
+            (t
+             (multiple-value-bind (significand exponent sign) (decode-float f)
+               (append 
+                `("Scientific: " ,(format nil "~E" f) (:newline)
+                                 "Decoded: " 
+                                 (:value ,sign) " * " 
+                                 (:value ,significand) " * " 
+                                 (:value ,(float-radix f)) "^" (:value ,exponent) (:newline))
+                (label-value-line "Digits" (float-digits f))
+                (label-value-line "Precision" (float-precision f))))))))
 
 (defmethod inspect-for-emacs ((stream file-stream) inspector)
   (declare (ignore inspector))




More information about the slime-cvs mailing list