mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-14 21:52:51 -06:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user