Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-utils/src/algebraic_ops.rs
6939 views
1
#[inline(always)]
2
pub 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)]
14
pub 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
25
pub fn alg_sum_f64(it: impl IntoIterator<Item = f64>) -> f64 {
26
it.into_iter().fold(0.0, alg_add_f64)
27
}
28
29