Shared Rust kernels
ported/cosh
All modules · quoted at commit 9e1884369a67 of DnaCalc/DnaCalc. Comments are the source's own.
cosh_kernel · 8 lines · calc-func/src/ported/cosh.rs on GitHubpub fn cosh_kernel(n: f64) -> f64 {
// Live Excel 16.0 b20326 Range.Value2: COSH(x)=(EXP(x)+EXP(-x))/2
// 40/40, including spilled EXP cells and E/2+EXP(-x)/2. libm cosh is
// 1 ULP off Excel at 0.001, 0.01, and 10.
let e = crate::ported::excel_numeric::excel_exp(n);
let em = crate::ported::excel_numeric::excel_exp(-n);
crate::ported::excel_numeric::excel_x87_add(e, em) / 2.0
}
Used by 4 functions.