Skip to content
Serra Royale edited this page Jun 11, 2025 · 1 revision

Function: float llFabs( float val );

Returns a float that is the positive version of val.

This function is similar to functions (e.g. fabs) found in many other languages, such as C++.

Examples

 default {

   state_entry()
   {
       llSay(0,"The (Float)absolute value of -4.5 is: "+(string)llFabs(-4.5) );
   }

} // returns : // The (Float)absolute value of -4.5 is: 4.500000

Notes

  • Using val-2*val*(val<0) is roughly 60% faster than llFabs as it avoids a function call, though it produces NaN if given an infinite value and (correctly) returns 0.0 instead of -0.0 when taking the absolute value of negative zero.

See Also

Functions

Clone this wiki locally