Skip to main content

Module doubled

Module doubled 

Source
Expand description

Double-double (“double-float”) arithmetic over SIMD vectors.

Ported from the doubled crate v0.3.3 (src/lib.rs, src/f64x.rs, src/f32x.rs) as used by sleef-rs rev 3671d46. Only the operations the ported kernels call are kept.

The doubled crate is MIT OR Apache-2.0, Copyright (c) 2018 Jorge Aparicio; see THIRD-PARTY-LICENSES.

§Fused formulation

Upstream selects between an FMA-based and a split-based formulation at compile time (cfg(target_feature = "fma")). This port always uses the FMA-based one, evaluated with fearless_simd::SimdFloat::mul_add_precise, which rounds the exact product-plus-add once on every level. Plain mul_add must not be substituted: on SSE2 and on WebAssembly without relaxed-simd it is a * b + c, which makes the residual below exactly zero and collapses the whole layer to single precision. The split-based formulation was measurably slower on the double-double-heavy kernels without being more accurate.

§Shape

Extension traits cannot be implemented for S::f64s (the projection is not a local type), so upstream’s method-style extension traits (MulAsDoubled, …) become free functions here, and the operators are implemented on the local f64::DD type.

Every function is defined once by the dd_family! macro, which is instantiated per element type, so the two families cannot drift apart.

Modules§

f32
Double-double arithmetic over native-width f32 vectors.
f64
Double-double arithmetic over native-width f64 vectors.