abs(a)
computes the absolute value of a
.
FORTRAN 77 and later
Elemental function
result = abs(a)
a
- the type of the argument shall be an integer
, real
, or complex
.The return value is of the same type and kind as the argument except the return value is real
for a complex
argument.
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