Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Data.Binary.IEEE754
Description
This module backports ieee754 double/float combinators from binary 0.8.4 to older version, and simply re-export these combinators for binary >= 0.8.4. You can safely import this module alongside Data.Binary.Get and Data.Binary.Put.
Implements casting via a 1-elemnt STUArray, as described in http://stackoverflow.com/a/7002812/263061.
Synopsis
- floatToWord :: Float -> Word32
- wordToFloat :: Word32 -> Float
- doubleToWord :: Double -> Word64
- wordToDouble :: Word64 -> Double
- getFloatbe :: Get Float
- getFloatle :: Get Float
- getFloathost :: Get Float
- getDoublebe :: Get Double
- getDoublele :: Get Double
- getDoublehost :: Get Double
- putFloatbe :: Float -> Put
- putFloatle :: Float -> Put
- putFloathost :: Float -> Put
- putDoublebe :: Double -> Put
- putDoublele :: Double -> Put
- putDoublehost :: Double -> Put
Double/Float Word cast
Double/Floats Get
getFloatbe :: Get Float #
Read a Float
in big endian IEEE-754 format.
getFloatle :: Get Float #
Read a Float
in little endian IEEE-754 format.
getFloathost :: Get Float #
Read a Float
in IEEE-754 format and host endian.
getDoublebe :: Get Double #
Read a Double
in big endian IEEE-754 format.
getDoublele :: Get Double #
Read a Double
in little endian IEEE-754 format.
getDoublehost :: Get Double #
Read a Double
in IEEE-754 format and host endian.
Double/Floats Put
putFloatbe :: Float -> Put #
Write a Float
in big endian IEEE-754 format.
putFloatle :: Float -> Put #
Write a Float
in little endian IEEE-754 format.
putFloathost :: Float -> Put #
Write a Float
in native in IEEE-754 format and host endian.
putDoublebe :: Double -> Put #
Write a Double
in big endian IEEE-754 format.
putDoublele :: Double -> Put #
Write a Double
in little endian IEEE-754 format.
putDoublehost :: Double -> Put #
Write a Double
in native in IEEE-754 format and host endian.