summaryrefslogtreecommitdiff
path: root/src/runtime/haskell/Data/Binary.hs
diff options
context:
space:
mode:
authorgdetrez <gdetrez@crans.org>2010-10-19 18:34:29 +0000
committergdetrez <gdetrez@crans.org>2010-10-19 18:34:29 +0000
commit1ed5b52a038e3a77a74433b9b3eaf21ac1c5e25b (patch)
treef1efff5f5b8baf6846e9770fdb2c2b07f9d42097 /src/runtime/haskell/Data/Binary.hs
parent96433c29146fa79c2e54778dd1c6095d0a54fc1f (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.hs10
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)