On 02.07.2014 20:04, Chris Barker wrote:
On Wed, Jul 2, 2014 at 10:36 AM, Julian Taylor <jtaylor.debian@googlemail.com <mailto:jtaylor.debian@googlemail.com>> wrote:
we recently fixed a float32/float64 issue in histogram. https://github.com/numpy/numpy/issues/4799
It's a good idea to keep the edges in the same dtype as the input data, it will make for fewer surprises, but I'm not sure that it's necessarily any more "correct". A value within an eps of a bin could arbitrarily end up on either side -- that's simply the nature of floating point.
I think it boils down to the use of round() in histogram which is not so great in python as its based on decimals not significant figures (so it does nothing for float32 values > 1e7).
Using decimals rather than sig-figs is a problem regardless of precision, and isn't that the same problem with C libmath round() ?
C round just rounds to the nearest integer and the result is still a float. numpy/python is different and implements round as round(d * 10**decimal) / 10**decimal