Table of Contents

Start Functions Events Constants Types Language Articles

Function: llFabs

float llFabs(float fval)

Return the absolute value of the parameter (for floats).

Parameters

fval

Any float value (can be negative)

Return value

Returns a float that is the absolute value of fval, that is, the value with any negative sign removed.

More rigorously, the result will be the same as fval if fval is positive or zero, and -fval if it is negative.

Notes

Short examples

float F = -2.25;
F = llFabs(F); // sets F to 2.25
F = llFabs(F); // F is still 2.25 because it was already positive
F = llFabs(0.0); // sets F to zero
F = llFabs(-PI); // sets F to approx. 3.141593
F = llFabs(0.5); // sets F to 0.5

See also