powered by
Computes exp(x) with protection against overflow. Values above max_exp are clamped before exponentiation to avoid Inf.
exp(x)
max_exp
Inf
safe_exp(x, max_exp = 700, warn = TRUE, param_name = "exponent")
exp(x), or exp(max_exp) for values that would overflow
exp(max_exp)
Numeric value or vector
Maximum allowed exponent, default 700
Logical; issue a warning when clamping occurs, default TRUE
Name used in warning messages
safe_exp(1) suppressWarnings(safe_exp(1000)) suppressWarnings(safe_exp(-1000))
Run the code above in your browser using DataLab