| Copyright | (c) Levent Erkok |
|---|---|
| License | BSD3 |
| Maintainer | erkokl@gmail.com |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Numbers.CrackNum
Contents
Description
A library for formatting/analyzing FP and Integer values
Internal representation of a Floating-point numbers
Complete internal representation for a floating-point number
Constructors
| FP | |
Fields
| |
Floating point precision
data IPrecision Source
Integer/Word precision
Constructors
| W8 | 8-bit unsigned (byte) |
| I8 | 8-bit signed |
| W16 | 16-bit unsigned (word) |
| I16 | 16-bit signed |
| W32 | 32-bit unsigned (double-word) |
| I32 | 32-bit signed |
| W64 | 64-bit unsigned (quad-word) |
| I64 | 64-bit signed |
Instances
| Eq IPrecision | |
| Show IPrecision | Show instance for integer-precisions |
Kinds of floating point values
Creating FP values
crackHP :: Integer -> FP Source
Crack a Haskell Integer value as a Half-precision floating point number
crackSP :: Integer -> FP Source
Crack a Haskell Integer value as a Single-precision floating point number
crackDP :: Integer -> FP Source
Crack a Haskell Integer value as a Double-precision floating point number
convertToIEEE :: Precision -> String -> FP Source
Convert the given string to a IEEE number with the required precision
Displaying FP and Int/Word values
displayInt :: IPrecision -> Integer -> String Source
Display a Integer (signed/unsigned) number in a nicely formatted way