HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulefloatshow-0.2.4Haskell98

Text.FShow.RealFloat

Faster String representations for floating point types. The code is largely taken from code in GHC.Float and the Show instance of Integer in GHC.Num to get the sequence of digits.

  • 4 types
  • 2 classes
  • 5 values
  • Packagefloatshow-0.2.4
  • Exports11
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceRealFloat.hs
classclass FShow a where
#

A duplicate of the Show class.

Methods

Instances7FShow, …
  • FShow Double7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • FShow Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • FShow FullDoubleDefined in floatshow-0.2.4 · Text.FShow.RealFloat
  • FShow FullFloatDefined in floatshow-0.2.4 · Text.FShow.RealFloat
  • FShow DoubleDefined in floatshow-0.2.4 · Text.FShow.RealFloat
  • FShow FloatDefined in floatshow-0.2.4 · Text.FShow.RealFloat
  • FShow a => FShow [a]Defined in floatshow-0.2.4 · Text.FShow.RealFloat
classclass 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^(binExp x) <= fst (decodeFloat x) < 2^(binExp x + 1)

for x > 0, so binExp x = floatDigits x - 1. The number of decimal digits that may be required is calculated with the formula

  decDigits x = 2 + floor (floatDigits x * logBase 10 2).

The default implementation uses an approximation of logBase 10 2 sufficient for mantissae of up to several thousand bits. Nevertheless, hardcoding the values in instance declarations may yield better performance.

Methods

  • decDigits :: a -> Int

    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 (fshow x)
    

    a smaller value can be given.

  • binExp :: a -> Int

    The base 2 logarithm of the mantissa returned by decodeFloat x for x > 0.

Instances6DispFloat
valuefshowFloat :: DispFloat a => a -> ShowS
#

Show a signed DispFloat value to full precision using standard decimal notation for arguments whose absolute value lies between 0.1 and 9,999,999, and scientific notation otherwise. Analogous to showFloat from GHC.Float.

valuefshowGFloat :: 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 fshowGFloat digs val, if digs is Nothing, the value is shown to full precision; if digs is Just d, then max 1 d digits after the decimal point are shown. Analogous to showGFloat from Numeric.

newtypenewtype Double7
#

newtype wrapper for Double. The Show (and FShow) instance displays numbers rounded to seven significant digits.

Constructors

Instances11Eq, Floating, Fractional, Num, Ord, Real, …
newtypenewtype FullDouble
#

newtype wrapper for Double. The Show (and FShow) instance displays all significant digits.

Constructors

Instances12Eq, Floating, Fractional, Num, Ord, Read, …
newtypenewtype Float7
#

newtype wrapper for Float. The Show (and FShow) instance displays numbers rounded to seven significant digits.

Constructors

Instances11Eq, Floating, Fractional, Num, Ord, Real, …
  • Eq Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • Floating Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • Fractional Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • Num Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • Ord Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • Real Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • RealFloat Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • RealFrac Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • Show Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • DispFloat Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
  • FShow Float7Defined in floatshow-0.2.4 · Text.FShow.RealFloat
newtypenewtype FullFloat
#

newtype wrapper for Double. The Show (and FShow) instance displays all significant digits.

Constructors

Instances12Eq, Floating, Fractional, Num, Ord, Read, …