ToIntegerPower and ToPower (Float functions): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (match syntax diagram to template; fix tags and links) |
||
Line 1: | Line 1: | ||
{{Template:Float:ToIntegerPower and ToPower subtitle}} | {{Template:Float:ToIntegerPower and ToPower subtitle}} | ||
The <var>ToPower</var> and <var>ToIntegerPower</var> <var>[[Intrinsic classes|intrinsic]]</var> functions return a number that is the method object value [http://en.wikipedia.org/wiki/Raised_to_the_power "raised to the power"] specified by the method argument. The argument value is initially rounded to the nearest integral value. | |||
[http://en.wikipedia.org/wiki/Raised_to_the_power raised to the power] specified by the method argument. | |||
The argument value is initially rounded to the nearest integral value. | |||
<var>ToPower</var> is a synonym for <var>ToIntegerPower</var>. | |||
==Syntax== | ==Syntax== | ||
{{Template:Float:ToIntegerPower syntax}} | {{Template:Float:ToIntegerPower syntax}} | ||
Line 14: | Line 10: | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>% | <tr><th>%number</th> | ||
<td>A numeric variable to contain the method result. </td></tr> | <td>A numeric variable to contain the method result. </td></tr> | ||
<tr><th> | <tr><th>float</th> | ||
<td>A Float value. </td></tr> | <td>A Float value. </td></tr> | ||
<tr><th> | <tr><th>number</th> | ||
<td>A Float value, which is rounded to the nearest integer.</td></tr> | <td>A Float value, which is rounded to the nearest integer.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul><li>If <var class="term">float</var> is 0 and <var class="term">number</var> is less than or equal to 0, the request is cancelled. | |||
<li><var>ToPower</var> / <var>ToIntegerPower</var> is available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.3</ul> | |||
==Examples== | ==Examples== | ||
The following statement returns | <ol><li>The following statement returns '<code>3:toPower(5) = 243</code>'. | ||
<p class="code"> [[PrintText statement|printText]] {~} = {3:toPower(5)}</p> | |||
The following statement returns | <li>The following statement returns '<code>-.1:toPower(2.8) is -0.001</code>'. | ||
<p class="code"> printText {~} is {-.1:toPower(2.8)}</p> | |||
The following statement returns | <li>The following statement returns '<code>2:toIntegerPower(-2.2) is 0.25</code>'. | ||
<p class="code"> printText {~} is {2:toIntegerPower(-2.2)}</p></ol> | |||
==See also== | ==See also== | ||
<ul><li><var>ToPower</var> / <var>ToIntegerPower</var>are object-oriented versions of the <var>[[$RXPI]]</var> function. | |||
{{Template:Float:ToIntegerPower and ToPower footer}} | {{Template:Float:ToIntegerPower and ToPower footer}} |
Revision as of 06:13, 4 February 2011
Raise number to an integer power (Float class)
The ToPower and ToIntegerPower intrinsic functions return a number that is the method object value "raised to the power" specified by the method argument. The argument value is initially rounded to the nearest integral value.
ToPower is a synonym for ToIntegerPower.
Syntax
%number = float:ToIntegerPower( exponent)
%number = float:ToPower( exponent)
Syntax terms
%number | A numeric variable to contain the method result. |
---|---|
float | A Float value. |
number | A Float value, which is rounded to the nearest integer. |
Usage notes
- If float is 0 and number is less than or equal to 0, the request is cancelled.
- ToPower / ToIntegerPower is available as of "Sirius Mods" Version 7.3
Examples
- The following statement returns '
3:toPower(5) = 243
'.printText {~} = {3:toPower(5)}
- The following statement returns '
-.1:toPower(2.8) is -0.001
'.printText {~} is {-.1:toPower(2.8)}
- The following statement returns '
2:toIntegerPower(-2.2) is 0.25
'.printText {~} is {2:toIntegerPower(-2.2)}
See also
- ToPower / ToIntegerPowerare object-oriented versions of the $RXPI function.