1 | (in-package :cl-user) |
---|
2 | |
---|
3 | ;;; <https://github.com/armedbear/abcl/issues/93> |
---|
4 | (let ((floats `(1f6 |
---|
5 | 1f-6 |
---|
6 | ,least-positive-normalized-single-float |
---|
7 | ,least-positive-single-float))) |
---|
8 | (prove:plan (length floats)) |
---|
9 | (dolist (float floats) |
---|
10 | (multiple-value-bind (quotient exponent sign) |
---|
11 | (decode-float float) |
---|
12 | (let ((radix (float-radix float))) |
---|
13 | (let ((lower (/ 1 radix))) |
---|
14 | (prove:ok |
---|
15 | (and (>= quotient lower) |
---|
16 | (< quotient 1)) |
---|
17 | (format nil "Whether ~a is between ~a and 1âŠ" quotient lower))))))) |
---|
18 | |
---|
19 | ;;; <https://github.com/armedbear/abcl/issues/94> |
---|
20 | (let ((floats `(,least-positive-normalized-double-float |
---|
21 | ,(/ least-positive-normalized-double-float 2) |
---|
22 | ,(/ least-positive-normalized-double-float 4) |
---|
23 | ,(/ least-positive-normalized-double-float 8) |
---|
24 | ,(/ least-positive-normalized-double-float 16) |
---|
25 | ,(/ least-positive-normalized-double-float 1024)))) |
---|
26 | (prove:plan (length floats)) |
---|
27 | (dolist (float floats) |
---|
28 | (multiple-value-bind (quotient exponent sign) |
---|
29 | (decode-float float) |
---|
30 | (let ((radix (float-radix float))) |
---|
31 | (let ((lower (/ 1 radix))) |
---|
32 | (prove:ok |
---|
33 | (and (>= quotient lower) |
---|
34 | (< quotient 1)) |
---|
35 | (format nil "Whether ~a is between ~a and 1âŠ" quotient lower))))))) |
---|
36 | |
---|
37 | ;;; <https://github.com/armedbear/abcl/issues/95> |
---|
38 | (let ((floats `(1d0 ,most-positive-double-float ,least-positive-double-float))) |
---|
39 | (prove:plan (* 2 (length floats))) |
---|
40 | (dolist (float floats) |
---|
41 | (prove:is-type float 'double-float) |
---|
42 | (let ((result (decode-float float))) |
---|
43 | (prove:is-type result 'double-float)))) |
---|
44 | |
---|
45 | (prove:finalize) |
---|