Difference between revisions of "LlAbs"

From Second Life Wiki
Jump to navigation Jump to search
m (LSL Function llAbs moved to LlAbs: revert, use {{lowercase}} template in such situations)
(update example function)
Line 1: Line 1:
=llAbs - Returns the absolute value of the integer passed to it=
Returns the absolute value of the integer passed to it.


==Syntax:==
==Syntax==
integer llAbs( integer val);
integer llAbs(integer number);
* number may be any integer.


==Full Functional Description:==
==Specification==
This function returns the absolute value passed to it.  Basically, it removes the negative sign, on the number if there is one.  If the parameter is a positive one, it just returns it
This function returns the absolute value of the number given to it.  If the number passed is less than zero, then it will return the opposite of that number.  If it is greater than or equal to zero, it will return the number given to it.
<!--In other words:


==Parameters:==
<math>f(n) =  
* val - This is a number that you want to find the absolute value of.
\begin{cases}
x,  & \mbox{if }x \ge 0 \\
-x, & \mbox{if }x < 0
\end{cases}</math>-->


==Caveats==
* None known at this time.


==Examples:==
==Examples==
  llSay(0,"The absolute value of -4 is: "+(string)llAbs(-4) );
<blockquote><pre>
llSay(0,"The absolute value of -4 is: "+(string)llAbs(-4) );
</pre></blockquote>


 
==See also==
 
==Caveats:==
* None known at this time.

Revision as of 21:01, 24 January 2007

Returns the absolute value of the integer passed to it.

Syntax

integer llAbs(integer number);

  • number may be any integer.

Specification

This function returns the absolute value of the number given to it. If the number passed is less than zero, then it will return the opposite of that number. If it is greater than or equal to zero, it will return the number given to it.

Caveats

  • None known at this time.

Examples

llSay(0,"The absolute value of -4 is: "+(string)llAbs(-4) );

See also