regression-simple-0.2.1: Simple linear and quadratic regression
Safe HaskellSafe-Inferred
LanguageHaskell2010

Numeric.KBN

Description

math-functions has KBN-Babuška-Neumaier summation algorithm as well in Numeric.Sum module.

Synopsis

Documentation

data KBN Source #

KBN summation accumulator.

Constructors

KBN !Double !Double 

Instances

Instances details
Show KBN Source # 
Instance details

Defined in Numeric.KBN

Methods

showsPrec :: Int -> KBN -> ShowS #

show :: KBN -> String #

showList :: [KBN] -> ShowS #

NFData KBN Source # 
Instance details

Defined in Numeric.KBN

Methods

rnf :: KBN -> () #

sumKBN :: Foldable f => f Double -> Double Source #

KBN summation algorithm.

>>> sumKBN (replicate 10 0.1)
1.0
>>> Data.List.foldl' (+) 0 (replicate 10 0.1) :: Double
0.9999999999999999
>>> sumKBN [1, 1e100, 1, -1e100]
2.0
>>> Data.List.foldl' (+) 0 [1, 1e100, 1, -1e100]
0.0

addKBN :: KBN -> Double -> KBN Source #

Add a Double to KBN accumulator.