-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Crack various integer, floating-point data formats
--   
--   Crack HP, SP and DP floats and 8, 16, 32, 64 bit words and integers.
--   
--   For details, please see:
--   http://github.com/LeventErkok/crackNum/
@package crackNum
@version 2.3

-- | A library for formatting/analyzing FP and Integer values
module Data.Numbers.CrackNum

-- | Complete internal representation for a floating-point number
data FP
FP :: Integer -> Precision -> Bool -> Int -> Int -> Int -> [Bool] -> String -> Kind -> FP

-- | The value as represented as a full Integer. Storage purposes only.
[intVal] :: FP -> Integer

-- | FP precision.
[prec] :: FP -> Precision

-- | Sign. If True then negative, otherwise positive.
[sign] :: FP -> Bool

-- | The exponent as it is stored.
[stExpt] :: FP -> Int

-- | The implicit bias of the exponent.
[bias] :: FP -> Int

-- | The actual exponent.
[expt] :: FP -> Int

-- | Bits in the fractional part
[fracBits] :: FP -> [Bool]

-- | Layout representation
[bitLayOut] :: FP -> String

-- | Floating-point kind (i.e., value)
[kind] :: FP -> Kind

-- | Floating point precision
data Precision

-- | Half precision; 16 bits = 1 sign + 5 exponent + 10 mantissa
HP :: Precision

-- | Single precision; 32 bits = 1 sign + 8 exponent + 23 mantissa
SP :: Precision

-- | Double precision; 64 bits = 1 sign + 11 exponent + 52 mantissa
DP :: Precision

-- | Integer/Word precision
data IPrecision

-- | 8-bit unsigned (byte)
W8 :: IPrecision

-- | 8-bit signed
I8 :: IPrecision

-- | 16-bit unsigned (word)
W16 :: IPrecision

-- | 16-bit signed
I16 :: IPrecision

-- | 32-bit unsigned (double-word)
W32 :: IPrecision

-- | 32-bit signed
I32 :: IPrecision

-- | 64-bit unsigned (quad-word)
W64 :: IPrecision

-- | 64-bit signed
I64 :: IPrecision

-- | Kinds of floating point values
data Kind

-- | Zero: 0. If Bool is true, then this is -0; otherwise +0.
Zero :: Bool -> Kind

-- | Infinity: oo. If Bool is true, then this is -oo, otherwie +oo.
Infty :: Bool -> Kind

-- | The signaling-NaN.
SNaN :: Kind

-- | The quiet-NaN.
QNaN :: Kind

-- | Denormalized number, i.e., leading bit is not 1
Denormal :: Kind

-- | Normal value.
Normal :: Kind

-- | Turn a Haskell float to the internal detailed FP representation
floatToFP :: Float -> FP

-- | Turn a Haskell double to the internal detailed FP representation
doubleToFP :: Double -> FP

-- | Convert the given string to a IEEE number with the required precision
stringToFP :: Precision -> String -> FP

-- | Crack a Haskell Integer value as the given precision floating value.
--   The Integer should be the value corresponding to the bit-pattern as
--   the float is laid out in memory according to the IEEE rules.
integerToFP :: Precision -> Integer -> FP

-- | Display a Floating-point number in a nicely formatted way. (This
--   function is also available through the Show instance for
--   FP, but is provided here for symmetry with displayWord.)
displayFP :: FP -> String

-- | Display a Integer (signed/unsigned) number in a nicely formatted way
displayWord :: IPrecision -> Integer -> String

-- | Reinterpret-casts a Float to a Word32.
floatToWord :: Float -> Word32

-- | Reinterpret-casts a Word32 to a Float.
wordToFloat :: Word32 -> Float

-- | Reinterpret-casts a Double to a Word64.
doubleToWord :: Double -> Word64

-- | Reinterpret-casts a Word64 to a Double.
wordToDouble :: Word64 -> Double
instance GHC.Show.Show Data.Numbers.CrackNum.Data.FP
