#
Fortran Wiki

abs

## Description

`abs(a)`

computes the absolute value of `a`

.

## Standard

FORTRAN 77 and later

## Class

Elemental function

## Syntax

`result = abs(a)`

## Arguments

`a`

- the type of the argument shall be an `integer`

, `real`

, or `complex`

.

## Return value

The return value is of the same type and kind as the argument except the return value is `real`

for a `complex`

argument.

## 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
```

Revised on April 30, 2009 17:37:33
by

Jason Blevins
(71.70.142.190)
(630 characters / 0.0 pages)