| 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
Synopsis
- 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 wrapper for Double. The Show (and FShow) instance
displays numbers rounded to seven significant digits.
Instances
| Eq Double7 # | |
| Floating Double7 # | |
| Fractional Double7 # | |
| Num Double7 # | |
| Ord Double7 # | |
Defined in Text.FShow.RealFloat | |
| Real Double7 # | |
Defined in Text.FShow.RealFloat Methods toRational :: Double7 -> Rational # | |
| RealFloat Double7 # | |
Defined in Text.FShow.RealFloat Methods floatRadix :: Double7 -> Integer # floatDigits :: Double7 -> Int # floatRange :: Double7 -> (Int, Int) # decodeFloat :: Double7 -> (Integer, Int) # encodeFloat :: Integer -> Int -> Double7 # significand :: Double7 -> Double7 # scaleFloat :: Int -> Double7 -> Double7 # isInfinite :: Double7 -> Bool # isDenormalized :: Double7 -> Bool # isNegativeZero :: Double7 -> Bool # | |
| RealFrac Double7 # | |
| Show Double7 # | |
| FShow Double7 # | |
| DispFloat Double7 # | |
newtype FullDouble #
Instances
newtype wrapper for Float. The Show (and FShow) instance
displays numbers rounded to seven significant digits.
Instances
| Eq Float7 # | |
| Floating Float7 # | |
| Fractional Float7 # | |
| Num Float7 # | |
| Ord Float7 # | |
| Real Float7 # | |
Defined in Text.FShow.RealFloat Methods toRational :: Float7 -> Rational # | |
| RealFloat Float7 # | |
Defined in Text.FShow.RealFloat Methods floatRadix :: Float7 -> Integer # floatDigits :: Float7 -> Int # floatRange :: Float7 -> (Int, Int) # decodeFloat :: Float7 -> (Integer, Int) # encodeFloat :: Integer -> Int -> Float7 # significand :: Float7 -> Float7 # scaleFloat :: Int -> Float7 -> Float7 # isInfinite :: Float7 -> Bool # isDenormalized :: Float7 -> Bool # isNegativeZero :: Float7 -> Bool # | |
| RealFrac Float7 # | |
| Show Float7 # | |
| FShow Float7 # | |
| DispFloat Float7 # | |