ToIntegerPower and ToPower (Float functions): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(27 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Template:Float:ToIntegerPower subtitle}}
{{Template:Float:ToIntegerPower and ToPower subtitle}}


{{Template:Float:ToPower subtitle}}
The <var>ToPower</var> and <var>ToIntegerPower</var> [[Intrinsic classes|intrinsic]] 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.


These [[Intrinsic classes|intrinsic]] functions return a number that is the method object value
<var>ToPower</var> is a synonym for <var>ToIntegerPower</var>.
[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.


''ToPower'' is a synonym for ''ToIntegerPower''.
Available as of version 7.3 of the [[Sirius Mods]], the ToIntegerPower and ToPower functions are
object-oriented versions of the $RXPI function.
==Syntax==
==Syntax==
{{Template:Float:ToIntegerPower syntax}}
{{Template:Float:ToIntegerPower syntax}}
{{Template:Float:ToPower syntax}}
{{Template:Float:ToPower syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%value </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>number </th>
 
<td>A Float value. </td></tr>
<tr><th>float</th>
<tr><th>exponent </th>
<td>A <var>Float</var> value. </td></tr>
<td>A Float value, which is rounded to the nearest integer.</td></tr>
 
<tr><th>exponent</th>
<td>A <var>Float</var> value, which is rounded to the nearest integer.  The method object <var class="term">float</var> is raised to the power of that rounded value.</td></tr>
</table>
</table>
==Usage Notes==
*If ''number'' is 0 and ''exponent'' is less than or equal to 0, the request is cancelled.
===Examples===
The following statement returns &ldquo;''3:toPower(5) = 243''&rdquo;.
    [[PrintText statement|printText]] {~} = {3:toPower(5)}
The following statement returns &ldquo;''-.1:toPower(2.8) is -0.001''&rdquo;.
    printText {~} is {-.1:toPower(2.8)}
The following statement returns &ldquo;''2:toIntegerPower(-2.2) is 0.25''&rdquo;.
    printText {~} is {2:toIntegerPower(-2.2)}


==See also==
==Usage notes==
[[List of intrinsic Float methods]]
<ul>
[[Category: Intrinsic Float methods|ToIntegerPower and ToPower function]]
<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.
[[Category: Intrinsic methods]]
<li><var>ToPower</var> / <var>ToIntegerPower</var> are object-oriented versions of the <var>$RXPI</var> function.
<li><var>ToPower</var> / <var>ToIntegerPower</var> are available as of <var class="product">Sirius Mods</var> Version 7.3.
</ul>
 
==Examples==
<ol>
<li>The following statement returns '<code>3:toPower(5) = 243</code>'.
<p class="code">  [[PrintText statement|printText]] {~} = {3:toPower(5)}</p>


<li>The following statement returns '<code>-.1:toPower(2.8) is -0.001</code>'.
<p class="code">  printText {~} is {-.1:toPower(2.8)}</p>


<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==
<section begin=dpl_desc />
{{Template:Float:ToIntegerPower and ToPower footer}}
Raise number to an integer power
<section end=dpl_desc />
-->

Latest revision as of 18:17, 2 November 2012

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 $RXPI function.
  • 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