llPow
Jump to navigation
Jump to search
All Issues ~ Search JIRA for related Bugs
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: float llPow( float base, float exponent );5 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns a float that is base raised to the power exponent (baseexponent)
• float | base | |||
• float | exponent |
Returns NaN when base is negative and exponent is not an integer (an imaginary result, (exponent != (integer)exponent) && (base < 0.0)
).
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 ofval = 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) + ").");
}
}