Difference between revisions of "LlSqrt"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 2: Line 2:
|func=llSqrt|sort=Sqrt
|func=llSqrt|sort=Sqrt
|func_id=4|func_sleep=0.0|func_energy=10.0
|func_id=4|func_sleep=0.0|func_energy=10.0
|func_footnote=Triggers a {{LSLC|Error/Math|Math Error]] for imaginary results <code>({{LSLPT|val}} < 0.0)</code>
|func_footnote=Triggers a {{LSLGC|Error/Math|Math Error}} for imaginary results <code>({{LSLPT|val}} < 0.0)</code>
|p1_type=float|p1_name=val|p1_desc=positive number (val &gt;= 0.0)
|p1_type=float|p1_name=val|p1_desc=positive number (val &gt;= 0.0)
|return_type=float
|return_type=float

Revision as of 15:59, 13 August 2013

Summary

Function: float llSqrt( float val );
0.0 Forced Delay
10.0 Energy

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.

Examples

<lsl> default {

 state_entry()
 {
   float num1 = llFrand(100.0);
   llOwnerSay("The square root of " + (string)num1 + " is " + (string)llSqrt(num1));
 }

}

</lsl>

Notes

If you need the square root of two use SQRT2.

See Also

Functions

•  llLog
•  llLog10
•  llPow

Deep Notes

Signature

function float llSqrt( float val );