method
Math.exp
Math.exp(x) -> fixed
Returns ex (the natural exponential), computed in Q16.16 as 2x·log₂e through a range-reduced integer polynomial — so it is bit-identical on every platform, the same guarantee the rest of the runtime gives. Pair it with Math.log for exponential decay and growth: cooldowns that ease off, difficulty ramps, or a value that relaxes toward a target. The result must land inside the fixed-point range (magnitudes below 32768), so keep x under about 10; larger exponents saturate.
Example
program Demo {
handler Step phase Update {
let remaining = Math.exp(0.0 - decay * elapsed) # smooth decay 1 -> 0
}
}