Math.exp

From GiderosMobile
Revision as of 08:40, 23 November 2025 by MoKaLux (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2011.6
Class: math

Description

Returns e^v.

(number) = math.exp(v)

Math.E is a constant that represents Euler's number, the base of the natural logarithm, approximately 2.71828.

Lua does not have a direct equivalent constant named math.E.

However, you can obtain the value of e in Lua by utilizing the math.exp() function, which calculates e raised to a given power. To get the value of e itself, you would raise e to the power of 1.

Parameters

v: (number) level of exponentiation for e

Return values

Returns (number) result of exponentiation

Example

Here is how to get the value of e in Lua

local e_value = math.exp(1)
print(e_value) -- output will be approximately 2.718281828459