hist icon indicating copy to clipboard operation
hist copied to clipboard

[BUG] axis.index finds wrong index when giving integer values

Open mpad opened this issue 2 years ago • 0 comments

the axis.index() function returns incorrect index when passed particular integer values.

Steps to reproduce Running under linux (fedora 35, python 3.6.10)

>>> hist.__version__
'2.6.2'
>>> a=hist.axis.Regular(50,0,50)
>>> [(i,a.index(i)) for i in range(28,31) ]
[(28, 28), (29, 28), (30, 30)]

I expect to obtain (29,29) as the 2nd entry as any other integer in the range 0..50 . With decimals, it works as expected :

>>> [(i,a.index(i+0.001)) for i in range(28,31) ]
[(28, 28), (29, 29), (30, 30)]

mpad avatar Oct 06 '22 11:10 mpad