pub fn softplus(x: f64) -> f64
softplus(x) = ln(1 + e^x), evaluated as max(x, 0) + ln(1 + e^{-|x|}) so that neither tail overflows and the small-x result keeps full relative accuracy.
softplus(x) = ln(1 + e^x)
max(x, 0) + ln(1 + e^{-|x|})
x