math.exp
Defined in module
"math"from "math" import expReturns e raised to the power of x
Parameters
x | number | the exponent |
Return value
e raised to the power of x, as a float.
Notes
The result is always a float, even when x is an integer: type(exp(0)) is "float".
A large enough x does not throw. It returns infinity, an ordinary float, not an error. A large enough negative x returns 0.0 rather than underflowing to an error.
Example
from "math" import exp
println("exp(0) =", exp(0))
println("exp(1) =", exp(1))
// the result is a float even when x is an integer
println("type(exp(0)) =", type(exp(0)))Output:
exp(0) = 1
exp(1) = 2.71828
type(exp(0)) = floatSee also
log | Returns the natural logarithm of x |
pow | Returns x raised to the power y |
| math | module index |