[Previous] [Contents] [Next]


Absolute Value


The absolute value of an integer or a float can be found with the abs( ) function:

integer abs(integer number)
float abs(float number)

The following examples show the result of abs( ) on floats and integers:

echo abs(-1);       // prints 1
echo abs(1);        // prints 1
echo abs(-145.89);  // prints 145.89
echo abs(145.89);   // prints 145.89

[Previous] [Contents] [Next]