Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Histogram fit for arrays of equal Float64 values #616

Closed
yurivish opened this issue Nov 13, 2020 · 1 comment
Closed

Incorrect Histogram fit for arrays of equal Float64 values #616

yurivish opened this issue Nov 13, 2020 · 1 comment

Comments

@yurivish
Copy link

julia> using StatsBase

julia> fit(Histogram, [1 for _ in 1:1000])
Histogram{Int64,1,Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}
edges:
  1.0:1.0:2.0
weights: [1000]
closed: left
isdensity: false

julia> fit(Histogram, [1.234 for _ in 1:1000])
Histogram{Int64,1,Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}
edges:
  2.234:2.0:4.234
weights: [0]
closed: left
isdensity: false

Fitting a histogram to all-equal integer values works, but not for all-equal float values – see the 0 weight in the second example. The bin edges seem to be computed incorrectly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants