| Copyright | (c) Dong Han 2017-2019 |
|---|---|
| License | BSD |
| Maintainer | winterland1989@gmail.com |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Std.Data.Builder.Numeric
Description
Textual numeric builders.
Synopsis
- data IFormat = IFormat {}
- defaultIFormat :: IFormat
- data Padding
- int :: (Integral a, Bounded a) => a -> Builder ()
- intWith :: (Integral a, Bounded a) => IFormat -> a -> Builder ()
- integer :: Integer -> Builder ()
- hex :: forall a. (FiniteBits a, Integral a) => a -> Builder ()
- heX :: forall a. (FiniteBits a, Integral a) => a -> Builder ()
- data FFormat
- double :: Double -> Builder ()
- doubleWith :: FFormat -> Maybe Int -> Double -> Builder ()
- float :: Float -> Builder ()
- floatWith :: FFormat -> Maybe Int -> Float -> Builder ()
- scientific :: Scientific -> Builder ()
- scientificWith :: FFormat -> Maybe Int -> Scientific -> Builder ()
- grisu3 :: Double -> Maybe ([Int], Int)
- grisu3_sp :: Float -> Maybe ([Int], Int)
- i2wDec :: Integral a => a -> Word8
- i2wHex :: Integral a => a -> Word8
- i2wHeX :: Integral a => a -> Word8
- countDigits :: Integral a => a -> Int
Integral type formatting
Integral formatting options.
Constructors
| IFormat | |
defaultIFormat :: IFormat Source #
defaultIFormat = IFormat 0 NoPadding False Decimal
Constructors
| NoPadding | |
| ZeroPadding | |
| LeftSpacePadding | |
| RightSpacePadding |
Fixded size hexidecimal formatting
hex :: forall a. (FiniteBits a, Integral a) => a -> Builder () Source #
Format a FiniteBits Integral type into hex nibbles.
heX :: forall a. (FiniteBits a, Integral a) => a -> Builder () Source #
The UPPERCASED version of hex.
IEEE float formating
Control the rendering of floating point numbers.
Constructors
| Exponent | Scientific notation (e.g. |
| Fixed | Standard decimal notation. |
| Generic | Use decimal notation for values between |
Instances
| Enum FFormat Source # | |
| Read FFormat Source # | |
| Show FFormat Source # | |
double :: Double -> Builder () Source #
Decimal encoding of an IEEE Double.
Using standard decimal notation for arguments whose absolute value lies
between 0.1 and 9,999,999, and scientific notation otherwise.
Format double-precision float using drisu3 with dragon4 fallback.
float :: Float -> Builder () Source #
Decimal encoding of an IEEE Float.
Using standard decimal notation for arguments whose absolute value lies
between 0.1 and 9,999,999, and scientific notation otherwise.
Format single-precision float using drisu3 with dragon4 fallback.
scientific :: Scientific -> Builder () Source #
A Builder which renders a scientific number to full
precision, using standard decimal notation for arguments whose
absolute value lies between 0.1 and 9,999,999, and scientific
notation otherwise.
Like scientific but provides rendering options.
Misc
countDigits :: Integral a => a -> Int Source #
Count how many decimal digits an integer has.