Teach the printer to print inexacts and complexes in hexadecimal.
authorTaylor R Campbell <campbell@mumble.net>
Fri, 16 Nov 2018 16:46:08 +0000 (16:46 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Fri, 16 Nov 2018 16:46:08 +0000 (16:46 +0000)
src/runtime/printer.scm
tests/runtime/test-readwrite.scm

index 1c4c5011f9db5e34bfcc91f8fba9c9a6c18af53f..97090ee7f082aa91d9d5c179be76dd2431bae8fa 100644 (file)
@@ -916,13 +916,12 @@ USA.
                  object
                  (let ((prefix
                         (lambda (prefix limit radix)
-                          (if (exact-rational? object)
-                              (begin
-                                (if (not (and (exact-integer? object)
-                                              (< (abs object) limit)))
-                                    (*print-string prefix context))
-                                radix)
-                              10))))
+                          (if (not (or (and (flo:flonum? object)
+                                            (not (flo:finite? object)))
+                                       (and (exact-integer? object)
+                                            (< (abs object) limit))))
+                              (*print-string prefix context))
+                          radix)))
                    (case (get-param:printer-radix)
                      ((2) (prefix "#b" 2 2))
                      ((8) (prefix "#o" 8 8))
index 4d651a1e0d0f53f9a3b429ac41cf6b2b9b1a8e86..c8b5bf3cbf4fd6ce21f5312a1b8b76167ff9dae8 100644 (file)
@@ -105,8 +105,8 @@ USA.
     ("nan.0" ,assert-symbol)
     ("#x123" ,assert-exact-integer)
     ("#x1/34" ,assert-exact-rational)
-    ("#x123+456i" ,assert-complex-nonreal xfail)
-    ("#x1.23p+0" ,assert-flonum xfail))
+    ("#x123+456i" ,assert-complex-nonreal)
+    ("#x1.23p+0" ,assert-flonum))
   (lambda (string #!optional assertion xfail?)
     (with-expected-failure xfail?
       (lambda ()