diff options
| author | gdetrez <gdetrez@crans.org> | 2010-10-19 18:34:29 +0000 |
|---|---|---|
| committer | gdetrez <gdetrez@crans.org> | 2010-10-19 18:34:29 +0000 |
| commit | 1ed5b52a038e3a77a74433b9b3eaf21ac1c5e25b (patch) | |
| tree | f1efff5f5b8baf6846e9770fdb2c2b07f9d42097 /src/runtime/haskell/Data/Binary.hs | |
| parent | 96433c29146fa79c2e54778dd1c6095d0a54fc1f (diff) | |
In the haskell code, we make the binary representation of the doubles compliant with IEEE 754.
The default binary representation in haskell's Data.Binary package is
homemade and quite complicated. Making it compliant with IEEE 754 will
make it easyer for the java runtimes (and probably others) to load the
PGF.
Diffstat (limited to 'src/runtime/haskell/Data/Binary.hs')
| -rw-r--r-- | src/runtime/haskell/Data/Binary.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/runtime/haskell/Data/Binary.hs b/src/runtime/haskell/Data/Binary.hs index 786f5a09e..ab6fcc2a3 100644 --- a/src/runtime/haskell/Data/Binary.hs +++ b/src/runtime/haskell/Data/Binary.hs @@ -62,7 +62,7 @@ import Data.Word import Data.Binary.Put import Data.Binary.Get - +import Data.Binary.IEEE754 ( putFloat64be, getFloat64be) import Control.Monad import Control.Exception import Foreign @@ -747,9 +747,13 @@ instance (Binary e) => Binary (Seq.Seq e) where ------------------------------------------------------------------------ -- Floating point +-- instance Binary Double where +-- put d = put (decodeFloat d) +-- get = liftM2 encodeFloat get get + instance Binary Double where - put d = put (decodeFloat d) - get = liftM2 encodeFloat get get + put = putFloat64be + get = getFloat64be instance Binary Float where put f = put (decodeFloat f) |
