Skip to content
lsl.devlsl.devLSL Dev

LlPow

Looking for the current API? Open the llPow reference →

Function notes

Returns NaN when base is negative and exponent is not an integer (an imaginary result, (exponent != (integer)exponent) && (base < 0.0)).

Return value notes

Returns a float that is base raised to the power exponent (baseexponent)

Caveats

  • If exponent is a static integer and not a variable, llPow is dramatically slower than simple repeated multiplication, i.e. it's much faster to do val = base*base*base instead of val = llPow(base, 3).
  • Triggers a Math Error for imaginary results if not compiled in Mono.

Examples

default {
     state_entry() {
          llOwnerSay("llPow(5, .5) (" + (string)llPow(5, .5) + ") is equal to llSqrt(5) (" 
                      + (string)llSqrt(5) + ").");
     }
}

See also: functions

Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from LlPow, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

  • LlPow (revision 1215254, )

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.