flat-0.3.2: Principled and efficient bit-oriented binary serialization.

Safe HaskellTrustworthy
LanguageHaskell2010

Data.FloatCast

Description

Primitives to convert between FloatDouble and Word32Word64 | This code was copied from binary | This module was written based on http://hackage.haskell.org/package/reinterpret-cast-0.1.0/docs/src/Data-ReinterpretCast-Internal-ImplArray.html.

Implements casting via a 1-element STUArray, as described in http://stackoverflow.com/a/7002812/263061.

Synopsis

Documentation

floatToWord :: Float -> Word32 Source #

Reinterpret-casts a Float to a Word32.

wordToFloat :: Word32 -> Float Source #

Reinterpret-casts a Word32 to a Float.

doubleToWord :: Double -> Word64 Source #

Reinterpret-casts a Double to a Word64.

wordToDouble :: Word64 -> Double Source #

Reinterpret-casts a Word64 to a Double.