ToIntegerPower and ToPower (Float functions): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (updates to reflect changes in syntax template, correct some spacing)
m ($RXPI is not a link)
Line 20: Line 20:
==Usage notes==
==Usage notes==
<ul><li>If <var class="term">float</var> is 0 and <var class="term">exponent</var> is less than or equal to 0, the request is cancelled.
<ul><li>If <var class="term">float</var> is 0 and <var class="term">exponent</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>
<li><var>ToPower</var> / <var>ToIntegerPower</var> are object-oriented versions of the Rocket function: <var>$RXPI</var>.
<li><var>ToPower</var> / <var>ToIntegerPower</var> are available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.3</ul>


==Examples==
==Examples==
<ol><li>The following statement returns '<code>3:toPower(5) = 243</code>'.
<ol><li>The following statement returns '<code>3:toPower(5) = 243</code>'.
<p class="code">  [[PrintText statement|printText]] {~} = {3:toPower(5)}</p>
<p class="code">  printText {~} = {3:toPower(5)}</p>
<li>The following statement returns '<code>-.1:toPower(2.8) is -0.001</code>'.
<li>The following statement returns '<code>-.1:toPower(2.8) is -0.001</code>'.
<p class="code">  printText {~} is {-.1:toPower(2.8)}</p>
<p class="code">  printText {~} is {-.1:toPower(2.8)}</p>
Line 31: Line 32:


==See also==
==See also==
<ul><li><var>ToPower</var> / <var>ToIntegerPower</var> are object-oriented versions of the <var>[[$RXPI]]</var> function.
<ul><li><var>PrintText</var> is described in the <var>[[Intrinsic classes#printtext|"System Intrinsic Class"]]</var>.</ul>
{{Template:Float:ToIntegerPower and ToPower footer}}
{{Template:Float:ToIntegerPower and ToPower footer}}

Revision as of 10:27, 22 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.
exponent A Float value, which is rounded to the nearest integer. The method object float is raised to the power of that rounded value.

Usage notes

  • If float is 0 and exponent is less than or equal to 0, the request is cancelled.
  • ToPower / ToIntegerPower are object-oriented versions of the Rocket function: $RXPI.
  • ToPower / ToIntegerPower are available as of "Sirius Mods" Version 7.3

Examples

  1. The following statement returns '3:toPower(5) = 243'.

    printText {~} = {3:toPower(5)}

  2. The following statement returns '-.1:toPower(2.8) is -0.001'.

    printText {~} is {-.1:toPower(2.8)}

  3. The following statement returns '2:toIntegerPower(-2.2) is 0.25'.

    printText {~} is {2:toIntegerPower(-2.2)}

See also