ABS — Absolute value#
-
ABS(A)#
ABS(A)computes the absolute value ofA.- Parameters:
A – The type of the argument shall be an
INTEGER,REAL, orCOMPLEX.- Returns:
The return value is of the same type and kind as the argument except the return value is
REALfor aCOMPLEXargument.
- Standard:
Fortran 77 and later, has overloads that are GNU extensions
- Class:
Elemental function
- Syntax:
RESULT = ABS(A)
- Example:
program test_abs integer :: i = -1 real :: x = -1.e0 complex :: z = (-1.e0,0.e0) i = abs(i) x = abs(x) x = abs(z) end program test_abs
- Specific names:
Name
Argument
Return type
Standard
ABS(A)REAL(4) AREAL(4)Fortran 77 and later
CABS(A)COMPLEX(4) AREAL(4)Fortran 77 and later
DABS(A)REAL(8) AREAL(8)Fortran 77 and later
IABS(A)INTEGER(4) AINTEGER(4)Fortran 77 and later
BABS(A)INTEGER(1) AINTEGER(1)GNU extension
IIABS(A)INTEGER(2) AINTEGER(2)GNU extension
JIABS(A)INTEGER(4) AINTEGER(4)GNU extension
KIABS(A)INTEGER(8) AINTEGER(8)GNU extension
ZABS(A)COMPLEX(8) AREAL(8)GNU extension
CDABS(A)COMPLEX(8) AREAL(8)GNU extension