Skip to content
lsl.devlsl.devLSL Dev

LlSqrt

Looking for the current API? Open the llSqrt reference →

Function notes

For imaginary results (val < 0.0), a Math Error is triggered under LSO , or 'NaN' (Not A Number) is returned under Mono

Return value notes

Returns a float that is the square root of val.

Caveats

  • Crashes the script if passed a negative number.

Examples

default
{
  state_entry()
  {
    float num1 = llFrand(100.0);

    llOwnerSay("The square root of " + (string)num1 + " is " + (string)llSqrt(num1));
  }
}

Notes

  • 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: 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 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.