Difference between revisions of "Math.exp"

From GiderosMobile
 
(2 intermediate revisions by one other user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Returns e^v.
 
Returns e^v.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(number) = math.exp(v)
 
(number) = math.exp(v)
</source>
+
</syntaxhighlight>
 +
 
 +
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 ===
 
=== Parameters ===
Line 14: Line 20:
 
=== Return values ===
 
=== Return values ===
 
'''Returns''' (number) result of exponentiation<br/>
 
'''Returns''' (number) result of exponentiation<br/>
 +
 +
=== Example ===
 +
'''Here is how to get the value of e in Lua'''
 +
<syntaxhighlight lang="lua">
 +
local e_value = math.exp(1)
 +
print(e_value) -- output will be approximately 2.718281828459
 +
</syntaxhighlight>
  
 
{{Math}}
 
{{Math}}

Latest revision as of 08:40, 23 November 2025

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