Description: | Computes an absolute value. | ||
Class: | Elemental function; Generic | ||
Arguments: | A must be of type integer, real, or complex. | ||
Results: | If A is an integer or real value, the value of the result is |A|; if A is a complex value (X, Y), the result is the real value SQRT (X**2 + Y**2). |
Specific Name | Argument Type | Result Type |
---|---|---|
INTEGER(1) | INTEGER(1) | |
IIABS | INTEGER(2) | INTEGER(2) |
IABS 1 | INTEGER(4) | INTEGER(4) |
KIABS | INTEGER(8) | INTEGER(8) |
ABS | REAL(4) | REAL(4) |
DABS | REAL(8) | REAL(8) |
QABS | REAL(16) | REAL(16) |
CABS 2 | COMPLEX(4) | REAL(4) |
CDABS 3 | COMPLEX(8) | REAL(8) |
CQABS | COMPLEX(16) | REAL(16) |
1 Or JIABS. For compatibility with
older versions of Fortran, IABS can also be specified as a generic
function.
2 The setting of compiler options specifying real size can affect CABS. 3 This function can also be specified as ZABS. |
Examples
ABS (-7.4) has the value 7.4.
ABS ((6.0, 8.0)) has the value 10.0.