HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulenumeric-prelude-0.4.4Haskell98

Number.Positional.Check

Interface to Number.Positional which dynamically checks for equal bases.

  • 1 type
  • 13 values
datadata T
#

The value Cons b e m represents the number b^e * (m!!0 / 1 + m!!1 / b + m!!2 / b^2 + ...). The interpretation of exponent is chosen such that floor (logBase b (Cons b e m)) == e. That is, it is good for multiplication and logarithms. (Because of the necessity to normalize the multiplication result, the alternative interpretation wouldn't be more complicated.) However for base conversions, roots, conversion to fixed point and working with the fractional part the interpretation b^e * (m!!0 / b + m!!1 / b^2 + m!!2 / b^3 + ...) would fit better. The digits in the mantissa range from 1-base to base-1. The representation is not unique and cannot be made unique in finite time. This way we avoid infinite carry ripples.

Instances18Eq, Fractional, Num, Ord, Show, Power, …
  • Eq TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • Fractional TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • Num TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • Ord TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • Show TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • Power TDefined in numeric-prelude-0.4.4 · Number.Positional.Check
  • C TDefined in numeric-prelude-0.4.4 · Number.Positional.Check

basic helpers

3 declarations
valuecompress :: T -> T
#

Shift digits towards zero by partial application of carries. E.g. 1.8 is converted to 2.(-2) If the digits are in the range (1-base, base-1) the resulting digits are in the range ((1-base)2-2, (base-1)2+2). The result is still not unique, but may be useful for further processing.

valuecarry :: T -> T
#

perfect carry resolution, works only on finite numbers

conversions

10 declarations