Skip to content

more accurate cumsum #9648

@stevengj

Description

@stevengj

This is my fault in #4039, I think: although cumsum implements a "pairwise" algorithm, unlike the sum function it doesn't actually get any accuracy benefit from this, and is in fact equivalent to naive summation:

x = rand(10^7)
foldl(+, 0.0, x) == cumsum(x)[end]

produces true. Is there an easy way to rearrange cumsum_pairwise so that it is as accurate as sum?

cc: @lindahua, @timholy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions