diff options
| author | Guillaume Bertholon | 2018-07-16 13:30:37 +0200 |
|---|---|---|
| committer | Pierre Roux | 2019-11-01 10:20:15 +0100 |
| commit | 1b0bd3a9e3a913a4928b68546a134a1a4448f9e8 (patch) | |
| tree | 3cd5378c9810fcd546c5f12ca25673ffb4ec2421 /test-suite/primitive/float/valid_binary_conv.v | |
| parent | 5c24b95890f6b57e6f20b03ade543e1e9d1e8324 (diff) | |
Add tests for primitive floats
Add utility ldexp and frexp functions to prevent dealing with the shift of
ldshiftexp and frshiftexp everywhere.
Also move primitive integer tests to place all primitive tests in the
same directory.
Diffstat (limited to 'test-suite/primitive/float/valid_binary_conv.v')
| -rw-r--r-- | test-suite/primitive/float/valid_binary_conv.v | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test-suite/primitive/float/valid_binary_conv.v b/test-suite/primitive/float/valid_binary_conv.v new file mode 100644 index 0000000000..ad81e55667 --- /dev/null +++ b/test-suite/primitive/float/valid_binary_conv.v @@ -0,0 +1,20 @@ +Require Import ZArith Floats. + +Definition two := Eval compute in (one + one)%float. +Definition half := Eval compute in (one / two)%float. +Definition huge := Eval compute in ldexp one (1023)%Z. +Definition tiny := Eval compute in ldexp one (-1022)%Z. +Definition denorm := Eval compute in ldexp one (-1074)%Z. + +Check (eq_refl : valid_binary (Prim2SF zero) = true). +Check (eq_refl : valid_binary (Prim2SF neg_zero) = true). +Check (eq_refl : valid_binary (Prim2SF one) = true). +Check (eq_refl : valid_binary (Prim2SF (-one)) = true). +Check (eq_refl : valid_binary (Prim2SF infinity) = true). +Check (eq_refl : valid_binary (Prim2SF neg_infinity) = true). +Check (eq_refl : valid_binary (Prim2SF huge) = true). +Check (eq_refl : valid_binary (Prim2SF tiny) = true). +Check (eq_refl : valid_binary (Prim2SF denorm) = true). +Check (eq_refl : valid_binary (Prim2SF nan) = true). +Check (eq_refl : valid_binary (Prim2SF two) = true). +Check (eq_refl : valid_binary (Prim2SF half) = true). |
