diff --git a/src/core/points.rkt b/src/core/points.rkt index 2bfff4eec..abd47274e 100644 --- a/src/core/points.rkt +++ b/src/core/points.rkt @@ -56,11 +56,6 @@ ;; Herbie's standard error measure is the average bits of error across ;; all points in a pcontext. -(define (point-error out exact repr) - (if ((representation-special-value? repr) out) - (+ 1 (expt 2 (representation-total-bits repr))) - (ulp-difference out exact repr))) - (define (average . s) (/ (apply + s) (length s))) @@ -72,9 +67,15 @@ (define (batch-errors exprs pcontext ctx) (define fn (compile-progs exprs ctx)) + (define repr (context-repr ctx)) + (define special? (representation-special-value? repr)) + (define max-error (+ 1 (expt 2 (representation-total-bits repr)))) + (for/list ([(point exact) (in-pcontext pcontext)]) (for/list ([out (in-vector (apply fn point))]) - (point-error out exact (context-repr ctx))))) + (if (special? out) + max-error + (ulp-difference out exact repr))))) ;; Herbie <=> JSON conversion for pcontext ;; A JSON pcontext is just a list of lists