summaryrefslogtreecommitdiff
path: root/cl/tests/maceps.lisp
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-09-25 10:36:23 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-09-25 10:36:23 -0600
commit58c73fd511b77cb94124b71a4bb75c7ab6a6d8bc (patch)
tree25ae52afe365de29973efbb10fdecf2712deb430 /cl/tests/maceps.lisp
parent2e284b71500a1f8dc6cc46ecf21eb1e9389ea780 (diff)
downloadcmath-58c73fd511b77cb94124b71a4bb75c7ab6a6d8bc.tar.gz
cmath-58c73fd511b77cb94124b71a4bb75c7ab6a6d8bc.zip
add september notes & hw2 code / pdf
Diffstat (limited to 'cl/tests/maceps.lisp')
-rw-r--r--cl/tests/maceps.lisp25
1 files changed, 25 insertions, 0 deletions
diff --git a/cl/tests/maceps.lisp b/cl/tests/maceps.lisp
new file mode 100644
index 0000000..9d61772
--- /dev/null
+++ b/cl/tests/maceps.lisp
@@ -0,0 +1,25 @@
+(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))))