From dbe9b14403999acd90fcf34e10dde8d29e9c9ad8 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 16 Nov 2018 16:46:08 +0000 Subject: [PATCH] Teach the printer to print inexacts and complexes in hexadecimal. --- src/runtime/printer.scm | 13 ++++++------- tests/runtime/test-readwrite.scm | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/runtime/printer.scm b/src/runtime/printer.scm index 1c4c5011f..97090ee7f 100644 --- a/src/runtime/printer.scm +++ b/src/runtime/printer.scm @@ -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)) diff --git a/tests/runtime/test-readwrite.scm b/tests/runtime/test-readwrite.scm index 4d651a1e0..c8b5bf3cb 100644 --- a/tests/runtime/test-readwrite.scm +++ b/tests/runtime/test-readwrite.scm @@ -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 () -- 2.25.1