power: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Initial write-up.)
 
No edit summary
Line 3: Line 3:
|version=1.3b36
|version=1.3b36
|description=
|description=
Returns a number raised to the power of {{code|2}}, or raised to a specific ''n-th'' power.
Returns a {{code|number}} raised to the power of {{code|2}}, or raised to a specific ''exponent''.


|usage=
|usage=
Line 13: Line 13:
</source>
</source>
<source lang="mtmacro" line>
<source lang="mtmacro" line>
pow(num, exp)
pow(num)
</source>
</source>
<source lang="mtmacro" line>
<source lang="mtmacro" line>
Line 19: Line 19:
</source>
</source>
'''Parameters'''
'''Parameters'''
* {{code|num}} - the base number used to perform the operation.
* {{code|num}} - the ''base number'' used to perform the operation.
* {{code|exp}} - the exponent used in the operation.
* {{code|exp}} - the ''exponent'' used in the operation.


|examples=
|examples=
Line 34: Line 34:
</source>
</source>
Returns: {{code|125}}
Returns: {{code|125}}
|also=
[[wp:Exponentiation|Exponentiation]], [[ln|ln()]]
}}
}}
[[Category:Mathematical Function]]
[[Category:Mathematical Function]]

Revision as of 08:33, 9 March 2009

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

Use pow() to raise 5 to the power of 2:
[r: power(5)]

Returns: 25

Use pow() to raise 5 to the power of 3:

[r: pow(5, 3)]
Returns: 125

See Also