polars_utils/
algebraic_ops.rs

1#[inline(always)]
2pub fn alg_add_f64(a: f64, b: f64) -> f64 {
3    #[cfg(feature = "nightly")]
4    {
5        std::intrinsics::fadd_algebraic(a, b)
6    }
7    #[cfg(not(feature = "nightly"))]
8    {
9        a + b
10    }
11}
12
13#[inline(always)]
14pub fn alg_mul_f64(a: f64, b: f64) -> f64 {
15    #[cfg(feature = "nightly")]
16    {
17        std::intrinsics::fmul_algebraic(a, b)
18    }
19    #[cfg(not(feature = "nightly"))]
20    {
21        a * b
22    }
23}
24
25pub fn alg_sum_f64(it: impl IntoIterator<Item = f64>) -> f64 {
26    it.into_iter().fold(0.0, alg_add_f64)
27}