Open Dominic-Stafford opened 2 years ago
This is discussed in boostorg/histogram somewhere, such as https://github.com/boostorg/histogram/issues/336. It's really an issue there, rather than here. The algorithm for computing edges has different numerical precision issues than the one for computing the fill, which is why they can be off. The Regular axis is optimized for performance.
When creating a Regular axis with an integer step size, integers that fall on the bin edges aren't consistently assigned to the same side of the bin edges:
I guess this is due to some sort of numerical precision issue, and one can see a similar behaviour with the edges, though this is clearly not exactly the same as from these one would expect neither of 56 or 58 to fall in the 28th bin, when in fact both do:
If it's difficult to fix this issue for regular axes, would it be possible to have a step option on integer axes? I observed the same problem for
bh.axis.Regular(100, 0, 100)
, but there one can just usebh.axis.Integer(0, 100)
instead, which doesn't have this problem