Fabs

From NWN Lexicon



Contents

[edit] fabs(float)

Gets the absolute value of a number.

float fabs(
    float fValue
);

[edit] Parameters

fValue

Float to retrieve the absolute value of.


[edit] Description

Returns the absolute (non-negative; numeric distance from the number 0) value of fValue.



[edit] Remarks

Useful when subtracting two numbers, without first having to find find out which is higher, when all you're interested in is the difference between the two.


[edit] Version

1.61

[edit] Example

void main()
{
//Both fFloat1 and fFloat2 will be 1.0
float fFloat1=fabs(3.0 - 2.0);
float fFloat2=fabs(2.0 - 3.0);
}

[edit] See Also

functions: 

abs



 author: Charles Feduke, editor: Lilac Soul
 

Personal tools
Categories