/
fabs
fabs
Description
The fabs command returns the absolute value of a floating point number. This return value is always greater than or equal to zero.
If a variable of type int is passed in as an argument, the fabs command will perform a floating point conversion, then return the absolute value of that float.
If the input data is of type int and the output type is desired to be of type int, use the abs command.
Functional area
Math
Command syntax
Syntax
fabs number |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
number | float | yes | If number is of type int, a floating point conversion will be performed. |
Flags
None
Return value
float
Returns a floating point value which is greater than or equal to 0
Examples
// Compute some absolute values float $absVal; $absVal = `fabs -5`; print $absVal; // Should be 5.000000 $absVal = `fabs -10.4520`; print $absVal; // Should be 10.452000
Additional information
Related commands
, multiple selections available,