[Numpy-discussion] numpy.histogram not giving expected results

Julian Taylor jtaylor.debian at googlemail.com
Wed Jul 2 13:36:25 EDT 2014


On 02.07.2014 19:29, Chris Barker wrote:
> On Wed, Jul 2, 2014 at 7:57 AM, Mark Szepieniec <mszepien at gmail.com
> <mailto:mszepien at gmail.com>> wrote:
> 
>     Looks this could be a float32 vs float64 problem:
> 
> 
> that would explain it.
>  
> 
>     I guess users always be very careful when mixing floating point
>     types, but should numpy prevent (or warn) the user from doing so in
>     this case?
> 
> 
> I don't think so -- this "uncertainty" is very much the nature of
> histogramming, particularly with floating point values -- you should
> expect to get different results with different data precisions. As you
> should for ANY floating point computation.
> 


we recently fixed a float32/float64 issue in histogram.
https://github.com/numpy/numpy/issues/4799
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).
Though this one seems different as it still occurs in git master.



More information about the NumPy-Discussion mailing list