From 98c5fc10ffc17ebdf078401058fb9e22270e32bd Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 25 Oct 2018 01:43:40 +0000 Subject: [PATCH] Use (assert-<= (relerr ...) bound) for better error messages. --- tests/runtime/test-arith.scm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/runtime/test-arith.scm b/tests/runtime/test-arith.scm index ea5a6a1cd..43c39244f 100644 --- a/tests/runtime/test-arith.scm +++ b/tests/runtime/test-arith.scm @@ -151,7 +151,7 @@ USA. (cons (log 2) 1.) (cons 0.7 1.0137527074704766)) (lambda (v) - (assert->= 1e-15 (relerr (cdr v) (expm1 (car v)))))) + (assert-<= (relerr (cdr v) (expm1 (car v))) 1e-15))) (define-enumerated-test 'log1p-approx (vector @@ -162,7 +162,7 @@ USA. (cons (- 1 (sqrt 1/2)) 0.25688251232181475) (cons 0.3 .26236426446749106)) (lambda (v) - (assert->= 1e-15 (relerr (cdr v) (log1p (car v)))))) + (assert-<= (relerr (cdr v) (log1p (car v))) 1e-15))) (define-enumerated-test 'log1mexp (vector @@ -172,7 +172,7 @@ USA. (cons -0.70 -0.686341002808385170) (cons -708 -3.30755300363840783e-308)) (lambda (v) - (assert->= 1e-15 (relerr (cdr v) (log1mexp (car v)))))) + (assert-<= (relerr (cdr v) (log1mexp (car v))) 1e-15))) (define-enumerated-test 'log1pexp (vector @@ -204,18 +204,18 @@ USA. (let ((x (vector-ref v 0)) (p (vector-ref v 1)) (t (vector-ref v 2))) - (assert->= 1e-15 (relerr p (logistic x))) + (assert-<= (relerr p (logistic x)) 1e-15) (if (and (not (= p 0)) (not (= p 1))) - (assert->= 1e-15 (relerr x (logit p)))) + (assert-<= (relerr x (logit p)) 1e-15)) (if (< p 1) (begin - (assert->= 1e-15 (relerr (- 1 p) (logistic (- x)))) + (assert-<= (relerr (- 1 p) (logistic (- x))) 1e-15) (if (<= 1/2 p) - (assert->= 1e-15 (relerr (- x) (logit (- 1 p)))))) - (assert->= 1e-300 (logistic (- x)))) - (assert->= 1e-15 (relerr t (log-logistic x))) + (assert-<= (relerr (- x) (logit (- 1 p))) 1e-15))) + (assert-<= (logistic (- x)) 1e-300)) + (assert-<= (relerr t (log-logistic x)) 1e-15) (if (<= x 709) - (assert->= 1e-15 (relerr x (logit-exp t)))) + (assert-<= (relerr x (logit-exp t)) 1e-15)) (if (< p 1) - (assert->= 1e-15 (relerr (log1p (- p)) (log-logistic (- x)))))))) \ No newline at end of file + (assert-<= (relerr (log1p (- p)) (log-logistic (- x))) 1e-15))))) \ No newline at end of file -- 2.25.1