As a followup, I believe there is at least once instance where we would not want to use float64 as the accumulator: if the field itself is integer and the sum does not overflow. Something like this might be better:
if 'int' in str(data[field].dtype) :
totals.append(data[field].sum(dtype=np.int64))
elif 'float' in str(data[field].dtype) :
totals.append(data[field].sum(dtype=np.float64))
else :
totals.append(data[field].sum())
Using np.float64 in the case of integers as well would alleviate the overflow problem, but would lead to approximate results where the user might expect an exact answer.
Douglas Rudd
Scientific Computing Consultant
Research Computing Center
Hi Doug,
I don't seem any reason why we wouldn't want to fix this to always use higher precision. Could you issue a PR?
Britton
_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org