-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Compensated floating-point arithmetic -- -- This package provides compensated floating point arithmetic. @package compensated @version 0.2 -- | This module provides a fairly extensive API for compensated floating -- point arithmetic based on Knuth's error free transformation, various -- algorithms by Ogita, Rump and Oishi, Hida, Li and Bailey, Kahan -- summation, etc. with custom compensated arithmetic circuits to do -- multiplication, division, etc. of compensated numbers. -- -- In general if a has x bits of significand, Compensated -- a gives you twice that. You can iterate this construction for -- arbitrary precision. -- -- References: -- --
-- x + y = a + b -- x = fl(a + b) ---- -- but only under the assumption that abs a >= -- abs b. If you aren't sure, use add. -- -- Which is to say that x is the floating point image of (a -- + b) and y stores the residual error term. fadd :: Num a => a -> a -> (a -> a -> r) -> r -- | add a b k computes k x y such that -- --
-- x + y = a + b -- x = fl(a + b) ---- -- Which is to say that x is the floating point image of (a -- + b) and y stores the residual error term. add :: Num a => a -> a -> (a -> a -> r) -> r -- | times a b k computes k x y such that -- --
-- x + y = a * b -- x = fl(a * b) ---- -- Which is to say that x is the floating point image of (a -- * b) and y stores the residual error term. -- -- This could be nicer if we had access to a hardware fused multiply-add. times :: Compensable a => a -> a -> (a -> a -> r) -> r -- | squared a k computes k x y such that -- --
-- x + y = a * a -- x = fl(a * a) ---- -- Which is to say that x is the floating point image of (a -- * a) and y stores the residual error term. squared :: Compensable a => a -> (a -> a -> r) -> r divide :: Compensable a => a -> a -> (a -> a -> r) -> r -- | error-free split of a floating point number into two parts. -- -- Note: these parts do not satisfy the compensated contract split :: Compensable a => a -> (a -> a -> r) -> r -- | Perform Kahan summation over a list. kahan :: (Foldable f, Compensable a) => f a -> Compensated a -- | Calculate a scalar + compensated sum with Kahan summation. (+^) :: Compensable a => a -> Compensated a -> Compensated a -- | Compute a * Compensated a (*^) :: Compensable a => a -> Compensated a -> Compensated a -- | Calculate a fast square of a compensated number. square :: Compensable a => Compensated a -> Compensated a instance (Compensable a, Precise a) => Precise (Compensated a) instance Compensable a => Floating (Compensated a) instance (Compensable a, Unbox a) => Vector Vector (Compensated a) instance (Compensable a, Unbox a) => MVector MVector (Compensated a) instance (Compensable a, Storable a) => Storable (Compensated a) instance (Compensable a, Serialize a) => SafeCopy (Compensated a) instance (Compensable a, Serialize a) => Serialize (Compensated a) instance (Compensable a, Binary a) => Binary (Compensated a) instance Compensable a => RealFrac (Compensated a) instance Compensable a => Real (Compensated a) instance Compensable a => Fractional (Compensated a) instance Compensable a => Enum (Compensated a) instance Compensable a => Num (Compensated a) instance (Reviewable p, Functor f, Compensable a, a ~ b) => Snoc p f (Compensated a) (Compensated b) a b instance (Reviewable p, Functor f, Compensable a, a ~ b) => Cons p f (Compensated a) (Compensated b) a b instance Compensable a => Monoid (Compensated a) instance Compensable a => Semigroup (Compensated a) instance Compensable a => Ord (Compensated a) instance Compensable a => Eq (Compensated a) instance (Applicative f, Compensable a, Compensable b) => Each f (Compensated a) (Compensated b) a b instance (Compensable a, Read a) => Read (Compensated a) instance (Compensable a, Show a) => Show (Compensated a) instance (Compensable a, Data a) => Data (Compensated a) instance (Compensable a, Hashable a) => Hashable (Compensated a) instance Typeable1 Compensated instance Compensable a => Compensable (Compensated a) instance Compensable Float instance Compensable Double