| Copyright | (c) 2011 Daniel Fischer |
|---|---|
| License | BSD3 |
| Maintainer | Daniel Fischer |
| Stability | experimental |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell98 |
Text.FShow.RealFloat
Description
- class FShow a where
- fshows :: FShow a => a -> ShowS
- class RealFloat a => DispFloat a where
- fshowFloat :: DispFloat a => a -> ShowS
- fshowEFloat :: DispFloat a => Maybe Int -> a -> ShowS
- fshowFFloat :: DispFloat a => Maybe Int -> a -> ShowS
- fshowGFloat :: DispFloat a => Maybe Int -> a -> ShowS
- newtype Double7 = D7 Double
- newtype FullDouble = FD {}
- newtype Float7 = F7 Float
- newtype FullFloat = FF {}
Documentation
A duplicate of the Show class.
class RealFloat a => DispFloat a where #
Class for specifying display parameters. The type a
is supposed to be an IEEE-ish (real) floating-point
type with floating-point radix 2, such that the mantissa
returned by decodeFloat satisfies
2^(binExpx) <=fst(decodeFloatx) < 2^(binExpx + 1)
for x > 0, so .
The number of decimal digits that may be required is calculated
with the formulabinExp x = floatDigits x - 1
decDigitsx = 2 +floor(floatDigitsx *logBase10 2).
The default implementation uses an approximation of
sufficient for mantissae of up to
several thousand bits. Nevertheless, hardcoding
the values in instance declarations may yield
better performance.logBase 10 2
Methods
The number of decimal digits that may be needed to
uniquely determine a value of type a.
For faster conversions which need not satisfy
x ==read(fshowx)
a smaller value can be given.
The base 2 logarithm of the mantissa returned by
for decodeFloat xx > 0.
fshowFloat :: DispFloat a => a -> ShowS #
fshowGFloat :: DispFloat a => Maybe Int -> a -> ShowS #
Show a signed DispFloat value
using standard decimal notation for arguments whose absolute value lies
between 0.1 and 9,999,999, and scientific notation otherwise.
In the call , if fshowGFloat digs valdigs is Nothing,
the value is shown to full precision; if digs is ,
then Just d digits after the decimal point are shown.
Analogous to max 1 d from Numeric.showGFloat
newtype FullDouble #