From: Taylor R Campbell Date: Fri, 30 Nov 2018 16:24:12 +0000 (+0000) Subject: What was I thinking. This is all wrong if the top bit is not 1. X-Git-Tag: mit-scheme-pucked-10.1.7~3^2~85 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=54194631dbf11e6dac2e6e6ca38b09c583e56f75;p=mit-scheme.git What was I thinking. This is all wrong if the top bit is not 1. --- diff --git a/tests/runtime/test-ieee754.scm b/tests/runtime/test-ieee754.scm index 2baf70d62..9dd060979 100644 --- a/tests/runtime/test-ieee754.scm +++ b/tests/runtime/test-ieee754.scm @@ -35,6 +35,11 @@ USA. (apply procedure arguments))) cases))) +(define (with-expected-failure xfail body) + (if (default-object? xfail) + (body) + (xfail body))) + (define ((test-ieee754-roundtrip w t bexp-inf/nan compose exact? decompose) bits) (let ((sign (extract-bit-field 1 (+ w t) bits)) @@ -132,14 +137,48 @@ USA. ,payload)))))))))) (define-enumerated-test 'ieee754-binary64-hex - '((0 "0x0p+0") + `((0 "0x0p+0") (-0. "-0x0p+0") - (1 "0x1p+0") - (-1 "-0x1p+0") + (,(+ (expt 2 -1050) (* (expt 16 -2) (expt 2 -1050))) + "0x1.01p-1050" + ,expect-failure) + (,(- (+ (expt 2 -1050) (* (expt 16 -2) (expt 2 -1050)))) + "-0x1.01p-1050" + ,expect-failure) + (,(+ (expt 2 -1022) (expt 2 -1074)) + "0x1.0000000000001p-1022" + ,expect-failure) + (,(- (+ (expt 2 -1022) (expt 2 -1074))) + "-0x1.0000000000001p-1022" + ,expect-failure) + (,(+ (expt 2 -1021) (expt 2 -1073)) + "0x1.0000000000001p-1021" + ,expect-failure) + (,(- (+ (expt 2 -1021) (expt 2 -1073))) + "-0x1.0000000000001p-1021" + ,expect-failure) + (,(+ (expt 2 -1021) (expt 2 -1072)) + "0x1.0000000000002p-1021" + ,expect-failure) + (,(+ (expt 2 -1021) (expt 2 -1071)) + "0x1.0000000000004p-1021" + ,expect-failure) + (,(+ (expt 2 -1021) (expt 2 -1070)) + "0x1.0000000000008p-1021" + ,expect-failure) + (,(+ (expt 2 -1021) (expt 2 -1069)) + "0x1.000000000001p-1021" + ,expect-failure) (1/2 "0x1p-1") (-1/2 "-0x1p-1") + (1 "0x1p+0") + (-1 "-0x1p+0") + (257/256 "0x1.01p+0" ,expect-failure) + (-257/256 "-0x1.01p+0" ,expect-failure) (12345 "0x1.81c8p+13") (123456 "0x1.e24p+16") (1.2061684984132626e-11 "0x1.a862p-37")) - (lambda (x s) - (assert-string= (ieee754-binary64-hex-string x) s))) + (lambda (x s #!optional xfail) + (with-expected-failure xfail + (lambda () + (assert-string= (ieee754-binary64-hex-string x) s)))))