Skip to content
lsl.devlsl.devLSL Dev

llSqrt

function
Function syntax
float llSqrt(
  1. 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.

How to use
float result = llSqrt(0.0);
  • Crashes the script if passed a negative number.
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).
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 LlSqrt, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

  • LlSqrt (revision 1215009, )

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.