|
|||||||||
Related Syntax | |||||||||
operator | exp |
Return type: OMX e raised to the power of x.
Returns:
Syntax
define external float function exp value float x
where
Use exp to calculate the value of e raised to the power of either a floating point number or a BCD number.
You must include one of the the following lines at the beginning of your OmniMark program:
e is Euler's number, and is approximately equal to 2.71828182845904523536028747135 ...
You use BCD mathematics typically for financial calculations and floating point mathematics typically for extremely large numbers.
You calculate the value of e raised to the argument of exp, as in
set my-value to exp (x)
If the result of an exponential value does not fit in the data type of the argument, the value returned is truncated to fit the data type.
If you take the exponential value of an integer, the result is coerced into the data type of the library you have included - either a floating point or BCD number.
In OmniMark, always surround operators with spaces.
BCD Example:
; Displays e to the power of 2 as a BCD include "ombcd.xin" process local bcd x initial {"2.3025850929940461"} local bcd result set result to exp (x) output "e to the power of " || "d" % x || " = " || "d" % result || "%n" ; Output: "e to the power of 2.3025850929940461 = 10.0000000000000002"
Floating Point Example:
; Displays the value of e to the power of 2 as a floating point number. include "omfloat.xin" process local float x initial {"2.3025850929940461"} local float result set result to exp (x) output "e to the power of " || "d" % x || " = " || "d" % result || "%n" ; Output: "e to the power of 2.3025850929940461 = 10"
In the example above, instead of using the line set result to exp (x)
, you could have written set result to e ** x
.
Related Syntax sqrt ln log10 ** (power operator) |
---- |