diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-05-09 08:18:51 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-05-09 08:18:51 +0000 |
commit | d71a5cfd10378301b71d32659d5936e01d72ae50 (patch) | |
tree | 9b6a7cc437ab205b7e0bf5bf90585451d8a8c367 /lib/Floataux.ml | |
parent | 913c1bcc4b2204afd447edd723e06b905fd1f47f (diff) | |
download | compcert-d71a5cfd10378301b71d32659d5936e01d72ae50.tar.gz compcert-d71a5cfd10378301b71d32659d5936e01d72ae50.zip |
Revised encoding/decoding of floats
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1341 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'lib/Floataux.ml')
-rw-r--r-- | lib/Floataux.ml | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Floataux.ml b/lib/Floataux.ml index 6b3b825f..ebea8841 100644 --- a/lib/Floataux.ml +++ b/lib/Floataux.ml @@ -11,7 +11,6 @@ (* *********************************************************************) open Camlcoq -open Integers let singleoffloat f = Int32.float_of_bits (Int32.bits_of_float f) @@ -31,9 +30,15 @@ let floatofintu i = let cmp c (x: float) (y: float) = match c with - | Ceq -> x = y - | Cne -> x <> y - | Clt -> x < y - | Cle -> x <= y - | Cgt -> x > y - | Cge -> x >= y + | Integers.Ceq -> x = y + | Integers.Cne -> x <> y + | Integers.Clt -> x < y + | Integers.Cle -> x <= y + | Integers.Cgt -> x > y + | Integers.Cge -> x >= y + +let bits_of_single f = coqint_of_camlint (Int32.bits_of_float f) +let single_of_bits f = Int32.float_of_bits (camlint_of_coqint f) + +let bits_of_double f = coqint_of_camlint64 (Int64.bits_of_float f) +let double_of_bits f = Int64.float_of_bits (camlint64_of_coqint f) |