Difference between revisions of "LlAbs"
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: | ||
Returns the absolute value of the integer passed to it. | |||
==Syntax | ==Syntax== | ||
integer llAbs( integer | integer llAbs(integer number); | ||
* number may be any integer. | |||
== | ==Specification== | ||
This function returns the absolute value | 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: | |||
= | <math>f(n) = | ||
\begin{cases} | |||
x, & \mbox{if }x \ge 0 \\ | |||
-x, & \mbox{if }x < 0 | |||
\end{cases}</math>--> | |||
==Caveats== | |||
* None known at this time. | |||
==Examples | ==Examples== | ||
<blockquote><pre> | |||
llSay(0,"The absolute value of -4 is: "+(string)llAbs(-4) ); | |||
</pre></blockquote> | |||
==See also== | |||
== | |||
Revision as of 20: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) );