úΆòƒ5$      !"#non-portable (GHC extensions) experimental1Daniel Fischer <daniel.is.fischer@googlemail.com>  Integer base-2 logarithm of a positive $. %6 converts a positive number into a list of digits and  an exponent. If x = 10^e*d_1.d_2...d_m... with d_1 /= 0 and  0 <= d_i <= 9, the result is ([d_1,d_2,...,d_m],e), where  m; is one or two larger than the number of requested digits,  provided that  2^(-70776) <= x < 2^248236 (with 64-bit &s,  the upper bound is about 2^1.3e9).  The number x# is (indirectly) given in the form  mantissa * 2^exponent , similar to ', A as the final two arguments. The second argument is the base-2 D logarithm of the mantissa and the first is the number of decimal < digits needed to discriminate between different numbers. In  digs mlog mant exp, it is assumed that  digs > 0,  mlog >= 0,  2^mlog <= mant < 2^(mlog+1). .These assumptions are not checked, and if they're not satisfied, 0 wrong results or worse are the consequences. You have been warned. GThe digits argument may be smaller than would be necessary to uniquely E determine each value if that is not required. As a rule of thumb, E requiring fewer significant digits means faster generation of the  representation. number of digits required base 2 logarithm of the mantissa  mantissa scaling exponent ()*+,-.%%non-portable (GHC extensions) experimental1Daniel Fischer <daniel.is.fischer@googlemail.com>)The Style in which to format the display / Use , for numbers with magnitude close enough to 1,  ( otherwise. The default range for using   is 0.1 <= |x| < 10^7, corresponding to  (0 (-1,7)). +Display in standard decimal notation, e.g. 0.0123  or 123.456 %Display in scientific notation, e.g. 1.234e-5 $Class for types whose values may be NaN or infinite and can & otherwise be decoded into the form m * 2^e.  defaults to 1 2  defaults to 1 2   x defaults to x < 0, it must be overridden if * negative zero has to be accounted for. :Class for types whose values can be decoded into the form  m * 2^e with an $ mantissa m and an & exponent e. $Minimal complete definition: one of   and  . BIt is strongly recommended to override the default implementation  of  . if the datatype allows distinguishing values * without using an exact representation.   is analogous to 3.   gives the integer base-2 logarithm of the mantissa  in addition to the result of  . If the absolute value of ? the mantissa always has the same highest set bit (excepting 0), E specifying that as a constant will be faster than calculating the + logarithm for each individual mantissa.  If  x = m*2^e with m /= 0, then    x == ( (4 m), m, e) must hold. BThe number of significant digits needed to uniquely determine the 8 value (or however many digits are desired). Usually,   D will be a constant function, but that is not necessary. However,  all values of   must be positive. 1If the mantissa always has the same highest bit, highBit, set  when it is nonzero,      _ = 2 + 5 ((highBit+1) * 6 10 2) /is sufficient to make the values and formatted /s E uniquely determine each other and in general this is the smallest D number to achieve that (calculate the number once and supply the  result as a constant). CIf the highest set bit of nonzero mantissae varies, things are not G so easy. If the width of mantissae is bounded, plugging the largest H possible value into the above formula works, but may yield an unduly 9 large number for common cases. Using the formula with highBit F determined by the mantissa almost works, but if the representation C is rounded at all, with sufficiently many bits in the mantissa, E there will be values between the original and the representation. D So, with mantissae of width varying over a large range, the only B feasible way of obtaining a bijection between values and their < decimal representations is printing to full precision in 3 general, optionally capping at the upper limit. CThe default implementation prints values exactly, which in general + is undesirable because it involves huge $ s and long  representations.  a e. calculates the number of decimal digits that . may be required to exactly display a value  x = m * 2^e where m is  an $ satisfying 2^a <= m < 2^(a+1). Usually, the calculated D value is not much larger than the actual number of digits in the @ exact decimal representation, but it will be if the exponent e J is negative and has large absolute value and the mantissa is divisible  by a large power of 2. 7 is a low-level formatter. The sign is determined from  the sign of the mantissa. decoder, same restrictions as   number of significant digits formatting style desired precision value to be displayed < is a low-level formatter producing an exact representation 1 of a value which can be decoded into the form m * 2^e. decoder, same restriction as   formatting style value to be displayed ' is the formatter for instances of the   D class. Any special values must be processed before it is called. 4 It fills in the missing arguments before calling . 4 is a slightly higher-level formatter, treating the  special cases of NaN and infinities.  builds the display / from the digits and ) the exponent of a nonnegative number. formatting style &number of significant digits required desired precision list of significant digits base-10 logarithm 78      non-portable (GHC extensions) experimentalDaniel Fischer9:;<A duplicate of the = class. newtype wrapper for >. The = (and  ) instance 9 displays numbers rounded to seven significant digits. newtype wrapper for ?. The = (and  ) instance 9 displays numbers rounded to seven significant digits. 2Class for specifying display parameters. The type a 7 is supposed to be an IEEE-ish (real) floating-point < type with floating-point radix 2, such that the mantissa  returned by 3 satisfies    2^( x) <= @ (3 x) < 2^( x + 1) for x > 0, so  x = A x - 1. C The number of decimal digits that may be required is calculated  with the formula     x = 2 + 5 (A x * 6 10 2). 4The default implementation uses an approximation of  6 10 2# sufficient for mantissae of up to 3 several thousand bits. Nevertheless, hardcoding 1 the values in instance declarations may yield  better performance. 3The number of decimal digits that may be needed to & uniquely determine a value of type a. 1 For faster conversions which need not satisfy    x == B ( x) a smaller value can be given. 1The base 2 logarithm of the mantissa returned by  3 x for x > 0. Same as C, but using an  instance. Show a signed  value to full precision I 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. !Show a signed  value / using scientific (exponential) notation (e.g. 2.45e2, 1.5e-3).  In the call ! digs val, if digs is D, * the value is shown to full precision; if digs is 0 d,  then E 1 d+ digits after the decimal point are shown.  Analogous to  showEFloat from Numeric. "Show a signed  value ' using standard decimal notation (e.g. 245000, 0.0015).  In the call " digs val, if digs is D, * the value is shown to full precision; if digs is 0 d,  then E 0 d+ digits after the decimal point are shown.  Analogous to  showFFloat from Numeric. #Show a signed  value I using standard decimal notation for arguments whose absolute value lies  between 0.1 and  9,999,999%, and scientific notation otherwise.  In the call # digs val, if digs is D, * the value is shown to full precision; if digs is 0 d,  then E 1 d+ digits after the decimal point are shown.  Analogous to  showGFloat from Numeric. FGH !"# !"# !"#I      !"#$%&'()*+,-./012345678/9:/;</9=,->/0?/@A/BC/0DEFGHIJ/KL,-M,-N/OP/0Q/RS/KT/;U/VWXEFYfloatshow-0.2.1Text.FShow.RawText.FShow.RealFloatText.FShow.RealFloat.Internals integerLog2 posToDigits FormatStyleGenericFixedExponent DecimalFormatnanTestinfTestnegTest BinDecodedecodedecodeL showDigitsfullDecimalDigits rawFormat fullRawFormat binDecFormat decimalFormat formatDigitsFShowfshow fshowsPrec fshowListFloat7F7Double7D7 DispFloat decDigitsbinExpfshows fshowFloat fshowEFloat fshowFFloat fshowGFloat integer-gmpGHC.Integer.TypeIntegeri2Dghc-prim GHC.TypesIntbase GHC.Float encodeFloatexpt5expt10maxEx5maxEx10expts5expts10integerToDigitsGHC.BaseString Data.MaybeJustconstFalse decodeFloatGHC.NumabsGHC.RealfloorlogBaseroundToSroundToFFFormat FFGenericFFFixed FFExponentGHC.ShowShowFloatDouble Data.Tuplefst floatDigits Text.ReadreadshowsNothing GHC.Classesmax formatFloat