fuzzy.lsp Version 1.00 31 October 2004 Author Steven Jones Contact jones57@swbell.net include the word "nyquist" in subject line The contents of this file are released under the terms of the GNU General Public License. See the file LICENSE.txt Fuzzy comparisons.
var
Default fuzzy comparison threshold.
function
(z= a b [e]) Fuzzy equality test. Return true iff a and b are approximately the same value. a - Flonum. Argument value. b - Flonum. Argument value. e - Flonum. Epsilon value, Default fuzzy:*epsilon* = 0.01 return - Bool. True iff |a-b| < e
;; fuzzy.lsp ;; Version 1.00 31 October 2004 ;; Author Steven Jones ;; ;; Contact jones57@swbell.net include the word "nyquist" in subject line ;; ;; The contents of this file are released under the terms of the GNU General ;; Public License. See the file LICENSE.txt ;; ;; Fuzzy comparisons. ;; (provide 'fuzzy) (current-file "fuzzy") ;; @doc var fuzzy:*epsilon* ;; Default fuzzy comparison threshold. ;; (setq fuzzy:*epsilon* 0.01) ;; @doc function z= ;; (z= a b [e]) ;; Fuzzy equality test. Return true iff a and b are approximately the same ;; value. ;; ;; a - Flonum. Argument value. ;; b - Flonum. Argument value. ;; e - Flonum. Epsilon value, Default fuzzy:*epsilon* = 0.01 ;; return - Bool. True iff |a-b| < e ;; (defun z= (a b &optional (epsilon fuzzy:*epsilon*)) (plusp (- epsilon (abs (- a b)))))