Coverage report: /home/ellis/comp/core/lib/math/prim.lisp
Kind | Covered | All | % |
expression | 0 | 44 | 0.0 |
branch | 0 | 6 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; prim.lisp --- Lisp Primitives
8
(defconstant +epsilon+ 1.e-7
9
"Used as a liminal value to work around floating point inaccuracy.")
11
(defconstant +pi+ (coerce pi 'single-float)
15
(defun ~ (a b &optional (epsilon +epsilon+))
16
"Return true if A and B are within EPSILON of each other. EPSILON
17
defaults to +DEFAULT-EPSILON+."
18
(< (- epsilon) (- a b) epsilon))
20
;;; Open code comparisons to constants: no substraction needed at runtime.
21
(define-compiler-macro ~ (&whole form a b &optional (epsilon +epsilon+))
22
(if (constantp epsilon)
23
(flet ((open-code (x constant)
24
(let ((c (eval constant))
26
`(< ,(- c e) ,x ,(+ c e)))))