lizfcm/cl/tests/maceps.lisp

26 lines
936 B
Common Lisp
Raw Normal View History

2023-09-25 12:36:23 -04:00
(defpackage lizfcm/tests.maceps
(:use :cl
:fiveam
:lizfcm.approx
:lizfcm.utils
:lizfcm/tests)
(:export :approx-suite))
(in-package :lizfcm/tests.maceps)
(def-suite maceps-suite
:in lizfcm-test-suite)
(in-suite maceps-suite)
(test maceps
:description "double precision provides precision about (mac eps of single precision) squared"
(let* ((maceps-computation-double (compute-maceps 1.0d0
(lambda (x) x)))
(maceps-computation-single (compute-maceps 1.0
(lambda (x) x)))
(last-double-h (cadar (last maceps-computation-double)))
(last-single-h (cadar (last maceps-computation-single))))
(is (within-range-p
(- last-double-h (* last-single-h last-single-h))
0
last-single-h))))