power: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) No edit summary |
No edit summary |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 6: | Line 6: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
power(num) | power(num) | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
power(num, exp) | power(num, exp) | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
pow(num) | pow(num) | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
pow(num, exp) | pow(num, exp) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
* {{code|num}} - the ''base number'' used to perform the operation. | * {{code|num}} - the ''base number'' used to perform the operation. | ||
Line 23: | Line 23: | ||
|examples= | |examples= | ||
Use {{code| | '''Example 1:''' Use {{code|power()}} to raise {{code|5}} to the power of {{code|2}}: | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: power(5)] | [r: power(5)] | ||
</ | </syntaxhighlight> | ||
Returns: {{code|25}} | '''Returns:''' {{code|25}} | ||
Use {{code|pow()}} to raise {{code|5}} to the power of {{code|3}}: | '''Example 2:''' Use {{code|pow()}} to raise {{code|5}} to the power of {{code|3}}: | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: pow(5, 3)] | [r: pow(5, 3)] | ||
</ | </syntaxhighlight> | ||
Returns: {{code|125}} | '''Returns:''' {{code|125}} | ||
|also= | |also= |
Latest revision as of 23:59, 14 March 2023
power() Function
• Introduced in version 1.3b36
Returns a
number
raised to the power of 2
, or raised to a specific exponent.Usage
power(num)
power(num, exp)
pow(num)
pow(num, exp)
Parameters
num
- the base number used to perform the operation.exp
- the exponent used in the operation.
Examples
Example 1: Use
Returns:
power()
to raise 5
to the power of 2
:
[r: power(5)]
Returns: 25
Example 2: Use pow()
to raise 5
to the power of 3
:
[r: pow(5, 3)]
125