llSqrt
function
Function syntax
float llSqrt(float val// Positive float value (must be >= 0.0).
);- Returns
float- Energy
- 10
For imaginary results (val < 0.0), a Math Error is triggered under LSO , or ‘NaN’ (Not A Number) is returned under Mono
Returns a float that is the square root of val.
float result = llSqrt(0.0);Caveats
Section titled “Caveats”- Crashes the script if passed a negative number.
Examples
Section titled “Examples”Example 1
default{ state_entry() { float num1 = llFrand(100.0);
llOwnerSay("The square root of " + (string)num1 + " is " + (string)llSqrt(num1)); }}- If you need the square root of two, you can use the constant
SQRT2. - Other roots can be computed by
llPow(val, 1.0/root).
See also
Section titled “See also”Functions
Section titled “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.