$nav
===== Function: llAbs =====
integer llAbs(integer ival)
Return the absolute value of the parameter (for integers).
===== Parameters =====
=== ival ===
Any $lty[integer] value (can be negative)
===== Return value =====
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 $prm[ival] if $prm[ival] is positive or zero, and $prm[-ival] if it is negative.
===== Notes =====
* To determine the absolute value of a $lty[float], use $lfn[llFabs].
* As a special case, the absolute value of -2,147,483,648 (-231, 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 =====
integer AbsInt;
AbsInt = llAbs(-3); // sets AbsInt to 3
AbsInt = llAbs(-45); // sets AbsInt to 45
AbsInt = llAbs(0); // sets AbsInt to 0
AbsInt = llAbs(45); // sets AbsInt to 45
Absint = llAbs(AbsInt - 50); // sets AbsInt to 5 (see explanation below)
The last example assumes that ''AbsInt'' was 45 due to the previous line. 45 - 50 equals -5, and ''llAbs(-5)'' equals 5.
===== See also =====
* $lfn[llFabs] takes the absolute value of a $ty[float].
* Other $lfn[math/] functions