Expm1
New to Analytica 6.3
_Expm1(x)
This is an internal function that is used to evaluate an expression of the form:
Exp(x)-1
or
1-Exp(x)
In the second case, the result is the negation of _Expm1(x)
. The expression must have exactly this form, with a literal constant 1.
The result of evaluating _Expm1(x)
is Exp(x)-1
. Direct evaluation of Exp(x)-1
loses precision when x
is small (i.e., abs(x)<<1
), so by using _Expm1(x)
instead it avoids numeric round-off problems.
When the parser sees an expression in either of the above forms, it replaces the expression with a direct call to _Expm1(x)
.
Note: For very small x, Exp(x)-1
≈1.
Examples
Exp(1e-20)-1 → 1e-20
Local ex:=Exp(1-20) Do ex-1
→ 0 { This one does not use _Expm1, and hence looses all precision }
See also
Comments
Enable comment auto-refresher