Difference between revisions of "LlSqrt"
Jump to navigation
Jump to search
Lady Sumoku (talk | contribs) m (Replaced old <LSL> block with <source lang="lsl2">) |
Omei Qunhua (talk | contribs) (NaN returned under Mono) |
||
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= | |func_footnote=For imaginary results (val < 0.0), a {{LSLGC|Error/Math|Math Error}} is triggered under LSO , or 'NaN' (Not A Number) is returned under Mono | ||
|p1_type=float|p1_name=val|p1_desc=positive number (val >= 0.0) | |p1_type=float|p1_name=val|p1_desc=positive number (val >= 0.0) | ||
|return_type=float | |return_type=float |
Revision as of 14:35, 13 January 2016
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
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) |
For imaginary results (val < 0.0), a Math Error is triggered under LSO , or 'NaN' (Not A Number) is returned under Mono
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 use SQRT2.