Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | None |
Documentation
Log
-domain Float
and Double
values.
Monad Log | |
Functor Log | |
Typeable1 Log | |
Applicative Log | |
Foldable Log | |
Traversable Log | |
Comonad Log | |
ComonadApply Log | |
Distributive Log | |
Traversable1 Log | |
Foldable1 Log | |
Apply Log | |
Bind Log | |
Extend Log | |
Eq a => Eq (Log a) | |
(RealFloat a, Precise a) => Floating (Log a) | |
(Precise a, RealFloat a, Eq a) => Fractional (Log a) | |
Data a => Data (Log a) | |
(Precise a, RealFloat a) => Num (Log a) | |
Ord a => Ord (Log a) | |
(Floating a, Read a) => Read (Log a) | |
(Precise a, RealFloat a, Ord a) => Real (Log a) | |
(Floating a, Show a) => Show (Log a) | |
Generic (Log a) | |
Storable a => Storable (Log a) | |
Binary a => Binary (Log a) | |
NFData a => NFData (Log a) | |
Hashable a => Hashable (Log a) | |
SafeCopy a0 => SafeCopy (Log a0) |
class Floating a => Precise a whereSource
This provides log1p
and expm1
for working more accurately with small numbers.
Computes log(1 + x)
This is far enough from 0 that the Taylor series is defined.
The Taylor series for exp(x) is given by
exp(x) = 1 + x + x^2/2! + ...
When x
is small, the leading 1 consumes all of the available precision.
This computes:
exp(x) - 1 = x + x^2/2! + ..
which can afford you a great deal of additional precision if you move things around algebraically to provide the 1 by other means.