abs
int8 abs(int8 value)int abs(int value)
float abs(float value)
Description
Returns the absolute value of the given numeric value.
The return type matches the type of the input argument.
Parameter
- value - A numeric value (int8, int or float) whose absolute value is to be returned.
Returns
The absolute value of value, with the same type as the input.
Example
void main()
{
int a = abs(-42); // a = 42
int b = abs(0); // b = 0
float c = abs(-3.14); // c = 3.14
int8 d = abs(-5); // d = 5
}