Skip to content

Bizarre behavior with Statistics.mean. #74

@bensetterholm

Description

@bensetterholm

I have two identical arrays generated in different ways which produce different means. What is going on here?

julia> using Measurements, Statistics

julia> a = fill(1.0 ± 0.5, 2)
2-element Array{Measurement{Float64},1}:
 1.0 ± 0.5
 1.0 ± 0.5

julia> b = [1.0 ± 0.5, 1.0 ± 0.5]
2-element Array{Measurement{Float64},1}:
 1.0 ± 0.5
 1.0 ± 0.5

julia> a == b
true

julia> mean(a)
1.0 ± 0.5

julia> mean(b)
1.0 ± 0.35

julia> mean(a) == mean(b)
false

(@v1.5) pkg> st Measurements
Status `~/.julia/environments/v1.5/Project.toml`
  [eff96d63] Measurements v2.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions