From f3760169274d1ee0d430ac63780557f5791be051 Mon Sep 17 00:00:00 2001 From: "Thomas M. Hermann" Date: Thu, 27 Nov 2008 02:12:57 +0000 Subject: [PATCH] [project @ Zero argument to ROUNDOFF-ERROR.] Detect the presence of a zero argument and handle it simply. --- lisp-unit.lisp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index e0f1af6..039e496 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -433,7 +433,9 @@ For more information, see lisp-unit.html. (defun roundoff-error (exact approximate) "Returned the error delta between the exact and approximate floating point value." - (abs (- (/ approximate exact) 1.0))) + (if (or (= 0.0 exact) (= 0.0 approximate)) + (+ exact approximate) + (abs (- (/ approximate exact) 1.0)))) ;;; (FLOAT-EQUAL x y &optional epsilon) => true or false ;;; Return true if the absolute difference between x and y is less -- 2.11.4.GIT