Skip to content

Commit 219485d

Browse files
committed
Use mul_add in var_axis for better accuracy
1 parent c289430 commit 219485d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/numeric/impl_numeric.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<A, S, D> ArrayBase<S, D>
167167
azip!(mut mean, mut sum_sq, x (subview) in {
168168
let delta = x - *mean;
169169
*mean = *mean + delta / count;
170-
*sum_sq = *sum_sq + delta * (x - *mean);
170+
*sum_sq = (x - *mean).mul_add(delta, *sum_sq);
171171
});
172172
}
173173
if ddof >= count {

0 commit comments

Comments
 (0)