ToIntegerPower and ToPower (Float functions)

From m204wiki
Revision as of 06:13, 4 February 2011 by Goff (talk | contribs) (match syntax diagram to template; fix tags and links)
Jump to navigation Jump to search

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

  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