This bug comes about when there are dimensions that are not being histogram'd ("bystander" dimensions). Currently we sum over all axis to estimate the area/volume of our histogram and then account bystander dimensions as a secondary step. However, this can produce incorrect results when NaNs are present because there may be a different number of NaNs along each bystander dimension.
There is a bug in the way histograms are normalised to densities that manifests when there are NaNs in the input data:
This bug comes about when there are dimensions that are not being histogram'd ("bystander" dimensions). Currently we sum over all axis to estimate the area/volume of our histogram and then account bystander dimensions as a secondary step. However, this can produce incorrect results when NaNs are present because there may be a different number of NaNs along each bystander dimension.