logaddexp

Function logaddexp 

Source
pub fn logaddexp(x: f64, y: f64) -> f64
Expand description

Perform ln(exp(x) + exp(y)) in a more numerically stable way

ยงExamples

Is equivalent to `logsumexp(&vec![x, y])

let x = -0.00231_f64;
let y = -0.08484_f64;

let lse = (x.exp() + y.exp()).ln();
let lae = logaddexp(x, y);

assert!((lse - lae).abs() < 1E-13);