Table of Contents

Start Functions Events Constants Types Language Articles

Function: llPow

float llPow(float base, float exp)

Raise a number to an exponent.

Parameters

base

The number to raise.

exp

The exponent to raise the base to.

Return value

The result of raising base to the power exp.

Notes

The rules for corner cases are somewhat convoluted. In order:

Short examples

float f;
f = llPow(1, 444);    // sets f to 1
f = llPow(0, 5);      // sets f to 0
f = llPow(5, 0);      // sets f to 1
f = llPow(0, 0);      // sets f to 1
f = llPow(2.7182818, 3); // raises 2.7182818 (the Euler constant) to the 3rd power,
                         // storing the result (approx. 20.085540) in f
f = llPow(-0.5, 4);   // sets f to 0.0625
f = llPow(-1.5, 1.5); // sets f to NaN because the base is negative and the exponent has decimals

See also