Difference between revisions of "LlSqrt"

From Second Life Wiki
Jump to navigation Jump to search
m
m (Replaced old <LSL> block with <source lang="lsl2">)
Line 10: Line 10:
|constants
|constants
|examples=
|examples=
<lsl>
<source lang="lsl2">
default
default
{
{
Line 20: Line 20:
   }
   }
}
}
</lsl>
</source>
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llLog]]|}}
|also_functions={{LSL DefineRow||[[llLog]]|}}

Revision as of 12:45, 22 January 2015

Summary

Function: float llSqrt( float val );

Returns a float that is the square root of val.

• float val positive number (val >= 0.0)

Triggers a Math Error for imaginary results (val < 0.0)

Caveats

  • Crashes the script if passed a negative number.
All Issues ~ Search JIRA for related Bugs

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 use SQRT2.

See Also

Functions

•  llLog
•  llLog10
•  llPow

Deep Notes

Search JIRA for related Issues

Signature

function float llSqrt( float val );

Haiku

Gleaming in the sun
the water gun lays broken.
It's SQuare RooT not SQuiRT.