- fpvector-sums xsprocedure
- xs
- f64vector
Computes the partial sums of the elements in xs in a way that incurs rounding error only once for each partial sum.
Example:
> (fpvector-sums #f64(1.0 1e-16 1e-16 1e-16 1e-16 1e+100 -1e+100)) #f64(1.0 1.0 1.0 1.0 1.0 1e+100 1.0)
Compare the same example computed by direct summation:
> (import srfi-1) > (cdr (reverse (fold (lambda (x xs) (cons (+ x (first xs)) xs)) (list 0.0) '(1.0 1e-16 1e-16 1e-16 1e-16 1e+100 -1e+100)))) '(1.0 1.0 1.0 1.0 1.0 1e+100 0.0)