Skip to main content

real_slice_sum

Function real_slice_sum 

Source
fn real_slice_sum(s: &[f64], na_rm: bool) -> f64
Expand description

sum for a double slice, following R’s rsum.

With na_rm, every NA and NaN is skipped (ISNAN). Without it, the result is the first element that is R’s NA (R_IsNA, so a computed NA such as NA_real_ * 1 counts), else NaN if any element is another NaN. R leaves the NA-vs-NaN outcome of a sum unspecified; letting NA win matches min and max.