promql::functions

Function compensated_sum_inc

Source
pub(crate) fn compensated_sum_inc(
    inc: f64,
    sum: f64,
    compensation: f64,
) -> (f64, f64)
Expand description

compensation(Kahan) summation algorithm - a technique for reducing the numerical error in floating-point arithmetic. The algorithm also includes the modification (“Neumaier improvement”) that reduces the numerical error further in cases where the numbers being summed have a large difference in magnitude Prometheus’s implementation: https://github.com/prometheus/prometheus/blob/f55ab2217984770aa1eecd0f2d5f54580029b1c0/promql/functions.go#L782