Skip to content
Snippets Groups Projects
Commit 24c656a5 authored by Raymond Toy's avatar Raymond Toy
Browse files

Add tests for compiled log2 and log10.

parent 106bf4fc
No related branches found
No related tags found
No related merge requests found
......@@ -21,3 +21,25 @@
(let ((x (float (expt 10 k) 1d0)))
(assert-equalp k (log x 10)))))
(compile 'clog2
#'(lambda (x)
(declare (type (double-float (0d0)) x))
(log x 2)))
(compile 'clog10
#'(lambda (x)
(declare (type (double-float (0d0)) x))
(log x 10)))
(define-test log2.compiled
(loop for k from -1074 to 1023 do
(let ((x (scale-float 1d0 k)))
(assert-equalp k (clog2 x)))))
(define-test log10.compiled
(loop for k from 0 to 22 do
(let ((x (float (expt 10 k) 1d0)))
(assert-equalp k (clog10 x)))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment