Skip to content

llFabs

float llFabs(float Value)

Returns the positive version of Value.

Returns the absolute value of Value.

Parameters
Value (float)
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
  • Using val - 2 * val * (val < 0) is roughly 60% faster than llFabs as it avoids a function call. However, this optimization produces NaN (not a number) if given an infinite value and returns 0.0 instead of -0.0 when taking the absolute value of negative zero.