@@ -74,7 +74,9 @@ mover(char *name,
7474/* dtype = [['float64'], ['float32']] */
7575MOVE (move_sum , DTYPE0 ) {
7676 Py_ssize_t count ;
77- npy_DTYPE0 asum , ai , aold ;
77+ // Keep the intermediate values in float64 to reduce precision error.
78+ // See issue pydata/bottleneck#164.
79+ npy_float64 asum , ai , aold ;
7880 INIT (NPY_DTYPE0 )
7981 BN_BEGIN_ALLOW_THREADS
8082 WHILE {
@@ -156,7 +158,9 @@ MOVE_MAIN(move_sum, 0)
156158/* dtype = [['float64'], ['float32']] */
157159MOVE (move_mean , DTYPE0 ) {
158160 Py_ssize_t count ;
159- npy_DTYPE0 asum , ai , aold , count_inv ;
161+ // Keep the intermediate values in float64 to reduce precision error.
162+ // See issue pydata/bottleneck#164.
163+ npy_float64 asum , ai , aold , count_inv ;
160164 INIT (NPY_DTYPE0 )
161165 BN_BEGIN_ALLOW_THREADS
162166 WHILE {
@@ -244,7 +248,9 @@ MOVE_MAIN(move_mean, 0)
244248/* dtype = [['float64'], ['float32']] */
245249MOVE (NAME , DTYPE0 ) {
246250 Py_ssize_t count ;
247- npy_DTYPE0 delta , amean , assqdm , ai , aold , yi , count_inv , ddof_inv ;
251+ // Keep the intermediate values in float64 to reduce precision error.
252+ // See issue pydata/bottleneck#164.
253+ npy_float64 delta , amean , assqdm , ai , aold , yi , count_inv , ddof_inv ;
248254 INIT (NPY_DTYPE0 )
249255 BN_BEGIN_ALLOW_THREADS
250256 WHILE {
0 commit comments