From: Taylor R Campbell Date: Fri, 16 Nov 2018 16:46:08 +0000 (+0000) Subject: Teach the printer to print inexacts and complexes in hexadecimal. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~71 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=dbe9b14403999acd90fcf34e10dde8d29e9c9ad8;p=mit-scheme.git Teach the printer to print inexacts and complexes in hexadecimal. --- 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 ()