(double-float double-float-epsilon)
(long-float long-float-epsilon))
(- exponent 1.0-exponent))))))
+
+(defun sinc (x)
+ (if (zerop x)
+ 1d0
+ (let ((x (coerce x 'double-float)))
+ (/ (sin x) x))))
+
+
+(defun number-within-percentage (a b percent)
+ "Determines if two numbers are equal within a percentage difference."
+ (let ((abs-diff (* 0.01 percent 0.5 (+ (abs a) (abs b)))))
+ (< (abs (- a b)) abs-diff)))
#+(and lispworks (not win32)) (system::getpid)
#+sbcl (sb-posix:getpid)
#+cmu (unix:unix-getpid)
- #+openmcl (ccl:getpid)
+ #+openmcl (ccl::getpid)
#+(and clisp unix) (system::program-id)
#+(and clisp win32) (cond ((find-package :win32)
(funcall (find-symbol "GetCurrentProcessId"
#:histogram
#:fixnum-width
#:scaled-epsilon
-
+ #:sinc
+ #:number-within-percentage
+
;; macros.lisp
#:time-iterations
#:time-seconds
(deftest :unique.2
(unique-slot-values nil 'a)
nil)
-
+
+(deftest :nwp.1
+ (number-within-percentage 1. 1.1 9)
+ nil)
+
+(deftest :nwp.2
+ (number-within-percentage 1. 1.1 11)
+ t)
+
;;; MOP Testing