| 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
- data FP = FP {}
- data Precision
- data IPrecision
- data Kind
- crackFP :: Precision -> Integer -> FP
- convertToIEEE :: Precision -> String -> FP
- displayFP :: FP -> String
- displayInt :: IPrecision -> Integer -> String
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
crackFP :: Precision -> Integer -> FP Source
Crack a Haskell Integer value as the given precision floating value
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