From 8aded4f76b4426c6145bd24c2298d7b3d6381123 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 7 Dec 2018 04:48:34 +0000 Subject: [PATCH] Fix printing NaN sign. --- src/runtime/dragon4.scm | 2 +- tests/runtime/test-readwrite.scm | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/runtime/dragon4.scm b/src/runtime/dragon4.scm index fbfd68c04..eee2dcf62 100644 --- a/src/runtime/dragon4.scm +++ b/src/runtime/dragon4.scm @@ -90,7 +90,7 @@ not much different to numbers within a few orders of magnitude of 1. (or (and flonum-printer-hook (flonum-printer-hook x radix)) (cond ((flo:nan? x) - "+nan.0") + (if (flo:sign-negative? x) "-nan.0" "+nan.0")) ((flo:positive? x) (if (flo:infinite? x) "+inf.0" diff --git a/tests/runtime/test-readwrite.scm b/tests/runtime/test-readwrite.scm index 7549078ee..0109790b7 100644 --- a/tests/runtime/test-readwrite.scm +++ b/tests/runtime/test-readwrite.scm @@ -93,7 +93,7 @@ USA. ("inf.0" ,assert-symbol) ("nan.0" ,assert-symbol) ("+nan.0" ,assert-nan) - ("-nan.0" ,assert-nan ,expect-failure) + ("-nan.0" ,assert-nan) ("123" ,assert-exact-integer) ("1/34" ,assert-exact-rational) ("123+456i" ,assert-complex-nonreal) @@ -117,8 +117,8 @@ USA. ("-inf.0-inf.0i" ,assert-complex-nonreal) ("+inf.0+nan.0i" ,assert-complex-nonreal) ("+nan.0+inf.0i" ,assert-complex-nonreal) - ("+inf.0-nan.0i" ,assert-complex-nonreal ,expect-failure) - ("-nan.0+inf.0i" ,assert-complex-nonreal ,expect-failure) + ("+inf.0-nan.0i" ,assert-complex-nonreal) + ("-nan.0+inf.0i" ,assert-complex-nonreal) ("\"|\"" ,assert-string) ("\"\\\"\"" ,assert-string) ("\"\\\\\"" ,assert-string) @@ -138,7 +138,7 @@ USA. ("inf.0" ,assert-symbol) ("nan.0" ,assert-symbol) ("+nan.0" ,assert-nan) - ("-nan.0" ,assert-nan ,expect-failure) + ("-nan.0" ,assert-nan) ("#x123" ,assert-exact-integer) ("#x1/34" ,assert-exact-rational) ("#x123+456i" ,assert-complex-nonreal) @@ -166,8 +166,8 @@ USA. ("#x-inf.0-inf.0i" ,assert-complex-nonreal) ("#x+inf.0+nan.0i" ,assert-complex-nonreal) ("#x+nan.0+inf.0i" ,assert-complex-nonreal) - ("#x+inf.0-nan.0i" ,assert-complex-nonreal ,expect-failure) - ("#x-nan.0+inf.0i" ,assert-complex-nonreal ,expect-failure)) + ("#x+inf.0-nan.0i" ,assert-complex-nonreal) + ("#x-nan.0+inf.0i" ,assert-complex-nonreal)) (lambda (string #!optional assertion xfail) (with-expected-failure xfail (lambda () -- 2.25.1