You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered this issue through UnicodePlots (JuliaPlots/UnicodePlots.jl#229), but I believe the root cause lies in StatsBase.
It appears that histogram will drop some entries when the left-end of the data is a signed zero -0.0.
From the original issue
julia>histogram([0.0, 1.0])
┌ ┐
[0.0, 0.5) ┤█████████████████████████████████████ 1
[0.5, 1.0) ┤ 0
[1.0, 1.5) ┤█████████████████████████████████████ 1
└ ┘
Frequency
julia>histogram([-0.0, 1.0])
┌ ┐
[0.0, 0.5) ┤ 0# where did that zero go?
[0.5, 1.0) ┤ 0
[1.0, 1.5) ┤█████████████████████████████████████ 1
└ ┘
Frequency
julia>histogram([0.0, -0.0])
┌ ┐
[0.0, 1.0) ┤█████████████████████████████████████ 1# only one value?
└ ┘
Frequency
On the one hand, I can understand that -0.0 would technically fall in a separate bin than +0.0, because of floating-point ordering.
However, it was surprising to see those entries dropped from the total count.
The text was updated successfully, but these errors were encountered:
I encountered this issue through
UnicodePlots
(JuliaPlots/UnicodePlots.jl#229), but I believe the root cause lies inStatsBase
.It appears that
histogram
will drop some entries when the left-end of the data is a signed zero-0.0
.From the original issue
On the one hand, I can understand that
-0.0
would technically fall in a separate bin than+0.0
, because of floating-point ordering.However, it was surprising to see those entries dropped from the total count.
The text was updated successfully, but these errors were encountered: