-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A fixed-precision real number type -- -- A reasonably efficient implementation of arbitrary-but-fixed precision -- real numbers. This is inspired by, and partly based on, -- Data.Number.Fixed and Data.Number.CReal, but more efficient. @package fixedprec @version 0.2.2.2 -- | A reasonably efficient implementation of arbitrary-but-fixed precision -- real numbers. This is inspired by, and partly based on, -- Data.Number.Fixed and Data.Number.CReal, but more -- efficient. module Data.Number.FixedPrec -- | A type class for type-level integers, capturing a precision parameter. -- Precision is measured in decimal digits. class Precision e -- | Precision of 0 digits. data P0 -- | Precision of 1 digit. data P1 -- | Precision of 10 digits. data P10 -- | Precision of 100 digits. data P100 -- | Precision of 1000 digits. data P1000 -- | Precision of 2000 digits. data P2000 -- | Add 1 digit to the given precision. data PPlus1 e -- | Add 3 digits to the given precision. data PPlus3 e -- | Add 10 digits to the given precision. data PPlus10 e -- | Add 100 digits to the given precision. data PPlus100 e -- | Add 1000 digits to the given precision. data PPlus1000 e -- | The type of fixed-precision numbers. data FixedPrec e -- | Get the precision of a fixed-precision number, in decimal digits. getprec :: Precision e => FixedPrec e -> Int -- | Cast from any FixedPrec type to another. cast :: (Precision e, Precision f) => FixedPrec e -> FixedPrec f -- | Cast to a fixed-point type with three additional digits of accuracy. upcast :: Precision e => FixedPrec e -> FixedPrec (PPlus3 e) -- | Cast to a fixed-point type with three fewer digits of accuracy. downcast :: Precision e => FixedPrec (PPlus3 e) -> FixedPrec e -- | The function with_added_digits d f x -- evaluates f(x), adding d digits of accuracy to -- x during the computation. with_added_digits :: forall a f. Precision f => Int -> (forall e. Precision e => FixedPrec e -> a) -> FixedPrec f -> a -- | Return the positive fractional part of a fixed-precision number. The -- result is always in [0,1), regardless of the sign of the input. fractional :: Precision e => FixedPrec e -> FixedPrec e -- | Solve the quadratic equation x^2 + bx + c = 0 -- with maximal possible precision, using a numerically stable method. -- Return the pair (x1, x2) of solutions with x1 -- <= x2, or Nothing if no solution exists. -- -- This is far more precise, and probably more efficient, than naively -- using the quadratic formula. solve_quadratic :: Precision e => FixedPrec e -> FixedPrec e -> Maybe (FixedPrec e, FixedPrec e) -- | A version of the natural logarithm that returns a Double. The -- logarithm of just about any value can fit into a Double; so if -- not a lot of precision is required in the mantissa, this function is -- often faster than log. log_double :: (Floating a, Real a) => a -> Double instance GHC.Classes.Ord (Data.Number.FixedPrec.FixedPrec e) instance GHC.Classes.Eq (Data.Number.FixedPrec.FixedPrec e) instance Data.Number.FixedPrec.Precision e => GHC.Show.Show (Data.Number.FixedPrec.FixedPrec e) instance Data.Number.FixedPrec.Precision e => GHC.Num.Num (Data.Number.FixedPrec.FixedPrec e) instance Data.Number.FixedPrec.Precision e => GHC.Real.Fractional (Data.Number.FixedPrec.FixedPrec e) instance Data.Number.FixedPrec.Precision e => GHC.Real.Real (Data.Number.FixedPrec.FixedPrec e) instance Data.Number.FixedPrec.Precision e => GHC.Real.RealFrac (Data.Number.FixedPrec.FixedPrec e) instance Data.Number.FixedPrec.Precision e => GHC.Float.Floating (Data.Number.FixedPrec.FixedPrec e) instance Data.Number.FixedPrec.Precision e => System.Random.Random (Data.Number.FixedPrec.FixedPrec e) instance Data.Number.FixedPrec.Precision e => Data.Number.FixedPrec.Precision (Data.Number.FixedPrec.PPlus1000 e) instance Data.Number.FixedPrec.Precision e => Data.Number.FixedPrec.Precision (Data.Number.FixedPrec.PPlus100 e) instance Data.Number.FixedPrec.Precision e => Data.Number.FixedPrec.Precision (Data.Number.FixedPrec.PPlus10 e) instance Data.Number.FixedPrec.Precision e => Data.Number.FixedPrec.Precision (Data.Number.FixedPrec.PPlus3 e) instance Data.Number.FixedPrec.Precision e => Data.Number.FixedPrec.Precision (Data.Number.FixedPrec.PPlus1 e) instance Data.Number.FixedPrec.Precision Data.Number.FixedPrec.P2000 instance Data.Number.FixedPrec.Precision Data.Number.FixedPrec.P1000 instance Data.Number.FixedPrec.Precision Data.Number.FixedPrec.P100 instance Data.Number.FixedPrec.Precision Data.Number.FixedPrec.P10 instance Data.Number.FixedPrec.Precision Data.Number.FixedPrec.P1 instance Data.Number.FixedPrec.Precision Data.Number.FixedPrec.P0