Difference between revisions of "User:SignpostMarv Martin/Sandbox/llAbs"

From Second Life Wiki
Jump to navigation Jump to search
(created test article)
 
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
llAbs returns the distance of the {{User:SignpostMarv Martin/Sandbox/Template:LSL/variable|integer|val}} from 0. This function will be useful if the result of an operation or function is not guaranteed to be a positive {{User:SignpostMarv Martin/Sandbox/Template:LSL/type|integer}} or negative {{User:SignpostMarv Martin/Sandbox/Template:LSL/type|integer}}.
llAbs returns the distance of the {{User:SignpostMarv Martin/Sandbox/Template:LSL/variable|integer|val}} from 0. This function will be useful if the result of an operation or function is not guaranteed to be a positive {{User:SignpostMarv Martin/Sandbox/Template:LSL/type|integer}} or negative {{User:SignpostMarv Martin/Sandbox/Template:LSL/type|integer}}.


[[User:SignpostMarv Martin/Sandbox/llFabs|llFabs]] is the equivalent function to use when the result of an operation or function is known to be always or occasionally a {{User:SignpostMarv Martin/Sandbox/Template:LSL/type|float}}, although the result of such an operation could be typecast to an integer.
[[User:SignpostMarv Martin/Sandbox/llFabs|llFabs]] is the equivalent function to use when the result of an operation or function is known to be always or occasionally a {{User:SignpostMarv Martin/Sandbox/Template:LSL/type|float}}, although the result of such an operation or function could be '''typecast '''to an {{User:SignpostMarv Martin/Sandbox/Template:LSL/type|integer}}
 
== Examples ==
== Examples ==


Line 11: Line 10:
llAbs((integer)-7.99); //returns 7</pre></code></div>
llAbs((integer)-7.99); //returns 7</pre></code></div>


[[Category:Math]]
<!--[[Category:Math]]-->

Latest revision as of 17:45, 10 February 2007

integer llAbs (integer val)

llAbs returns the distance of the integer val from 0. This function will be useful if the result of an operation or function is not guaranteed to be a positive integer or negative integer.

llFabs is the equivalent function to use when the result of an operation or function is known to be always or occasionally a float, although the result of such an operation or function could be typecast to an integer

Examples

llAbs(-5); //returns 
llAbs(3); // returns 3
llAbs((integer)-7.99); //returns 7