- parseFloatBE :: RealFloat a => [Word8] -> a
- parseFloatLE :: RealFloat a => [Word8] -> a
- getFloat16be :: Get Float
- getFloat16le :: Get Float
- getFloat32be :: Get Float
- getFloat32le :: Get Float
- getFloat64be :: Get Double
- getFloat64le :: Get Double
- getFloat :: RealFloat a => ByteCount -> ([Word8] -> a) -> Get a
- putFloat32be :: Float -> Put
- putFloat32le :: Float -> Put
- putFloat64be :: Double -> Put
- putFloat64le :: Double -> Put
- putFloat :: RealFloat a => ByteCount -> (ByteCount -> Integer -> [Word8]) -> a -> Put
- exponentWidth :: BitCount -> BitCount
- bitSlice :: [Word8] -> BitCount -> BitCount -> Integer
- splitRawIEEE754 :: [Word8] -> (Bool, Exponent, Fraction)
- unbias :: Exponent -> BitCount -> Exponent
- mergeFloat :: Exponent -> Fraction -> BitCount -> (Integer, Int)
- bias :: Exponent -> BitCount -> Exponent
- encodeIntBE :: ByteCount -> Integer -> [Word8]
- encodeIntLE :: ByteCount -> Integer -> [Word8]
- floatToMerged :: RealFloat a => ByteCount -> a -> Integer
- mergeFloatBits :: BitCount -> BitCount -> Bool -> Fraction -> Exponent -> Integer
- floatComponents :: RealFloat a => ByteCount -> a -> (Bool, Fraction, Exponent)
- data Exponent
- data Fraction
- data BitCount
- data ByteCount
Parsing
parseFloatBE :: RealFloat a => [Word8] -> aSource
Parse a big-endian byte list into a floating-point value.
parseFloatLE :: RealFloat a => [Word8] -> aSource
Parse a little-endian byte list into a floating-point value.
getFloat :: RealFloat a => ByteCount -> ([Word8] -> a) -> Get aSource
Parse a floating-point value of the given width (in bytes) from within a Get monad.
Serializing
putFloat32be :: Float -> PutSource
putFloat32le :: Float -> PutSource
putFloat64be :: Double -> PutSource
putFloat64le :: Double -> PutSource
Parser implementation
exponentWidth :: BitCount -> BitCountSource
Calculate the proper size of the exponent field, in bits, given the size of the full structure.
bitSlice :: [Word8] -> BitCount -> BitCount -> IntegerSource
Considering a byte list as a sequence of bits, slice it from start inclusive to end exclusive, and return the resulting bit sequence as an integer
splitRawIEEE754 :: [Word8] -> (Bool, Exponent, Fraction)Source
Split a raw bit array into (sign, exponent, fraction) components. These components have not been processed (unbiased, added significant bit, etc).
mergeFloat :: Exponent -> Fraction -> BitCount -> (Integer, Int)Source
Parse values into a form suitable for encodeFloat sign exponent fraction width-in-bits -> fraction, exponent
Serializer implementation
encodeIntBE :: ByteCount -> Integer -> [Word8]Source
Encode an integer to a list of words, in big-endian format
encodeIntLE :: ByteCount -> Integer -> [Word8]Source
Encode an integer to a list of words, in little-endian format
floatToMerged :: RealFloat a => ByteCount -> a -> IntegerSource