Computes exp(x) with protection against overflow. Values above
max_exp are clamped before exponentiation to avoid Inf.
Examples
safe_exp(1)
#> [1] 2.718282
suppressWarnings(safe_exp(1000))
#> [1] 1.014232e+304
suppressWarnings(safe_exp(-1000))
#> [1] 9.859677e-305
