Function softplus
pub fn softplus(x: f64) -> f64Expand description
Numerically stable softplus: ln(1 + exp(x)).
For |x| > 50, uses asymptotic approximation:
- x > 50:
ln(1 + exp(x)) ≈ x(error < 1e-22) - x < -50:
ln(1 + exp(x)) ≈ exp(x) ≈ 0(return 0)
The transition at |x| = 50 is mathematically smooth to within crate::Wave precision. This is the standard numerically-stable implementation used throughout the Koren triode/pentode equations.