Skip to content

spurious overflow in std #195

@stevengj

Description

@stevengj
julia> std([1e300, -1e300])
Inf

whereas the correct answer is ≈ 1.4142e300, which is representable.

This is the same issue that arises in computing the norm of a vector, for which the naive algorithm overflows/underflows. This solution is simply to scale the array by dividing out maximum(abs, x) (this can be skipped if the maximum absolute value isn't too big or too small).

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