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.
This commit is contained in:
gdetrez
2010-10-19 18:34:29 +00:00
parent 96433c2914
commit 1ed5b52a03
3 changed files with 410 additions and 3 deletions

View File

@@ -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)