You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.
This shows you the differences between two versions of the page.
functions:llabs [2015-01-11 13:31 SLT] sei Style |
functions:llabs [2015-09-22 11:56 SLT] (current) sei wording |
||
---|---|---|---|
Line 11: | Line 11: | ||
=== ival === | === ival === | ||
- | Any [[types/integer]] value (can be negative) | + | Any $lty[integer] value (can be negative) |
===== Return value ===== | ===== Return value ===== | ||
- | It returns an integer that is the absolute value of **ival**, that is, the value with any negative sign removed. | + | It returns an integer that is the absolute value of $prm[ival], that is, the value with any negative sign removed. |
- | More rigorously, the result will be the same as **ival** if **ival** is positive or zero, and -**ival** if it is negative. | + | More rigorously, the result will be the same as $prm[ival] if $prm[ival] is positive or zero, and $prm[-ival] if it is negative. |
===== Notes ===== | ===== Notes ===== | ||
- | * To determine the absolute value of a [[types/float]], use [[llFabs]]. | + | * To determine the absolute value of a $lty[float], use $lfn[llFabs]. |
- | * As a special case, the absolute value of -2,147,483,648 (-2<sup>31</sup>, the lowest integer LSL supports) is returned by this function as -2,147,483,648 because the positive integer 2,147,483,648 is outside the range of LSL [[types/integer|integers]]. | + | * As a special case, the absolute value of -2,147,483,648 (-2<sup>31</sup>, the lowest integer LSL supports) is returned by this function as -2,147,483,648 because the positive integer 2,147,483,648 is outside the range of a LSL $lty[integer]. |
===== Short examples ===== | ===== Short examples ===== | ||
Line 34: | Line 34: | ||
Absint = llAbs(AbsInt - 50); // sets AbsInt to 5 (see explanation below) | Absint = llAbs(AbsInt - 50); // sets AbsInt to 5 (see explanation below) | ||
</code> | </code> | ||
- | The last example assumes that **AbsInt** was 45 due to the previous line. 45 - 50 equals -5, and **llAbs**(-5) equals 5. | + | The last example assumes that ''AbsInt'' was 45 due to the previous line. 45 - 50 equals -5, and ''llAbs(-5)'' equals 5. |
===== See also ===== | ===== See also ===== | ||
- | * [[llFabs]] takes the absolute value of a [[types/float]]. | + | * $lfn[llFabs] takes the absolute value of a $ty[float]. |
+ | * Other $lfn[math/] functions |