NAG FL Interface
a02abf (abs)
1
Purpose
a02abf returns the value of the modulus of the complex number .
2
Specification
Fortran Interface
Function a02abf ( |
xr, xi) |
Real (Kind=nag_wp) |
:: |
a02abf |
Real (Kind=nag_wp), Intent (In) |
:: |
xr, xi |
|
C Header Interface
#include <nag.h>
double |
a02abf_ (const double *xr, const double *xi) |
|
C++ Header Interface
#include <nag.h> extern "C" {
double |
a02abf_ (const double &xr, const double &xi) |
}
|
The routine may be called by the names a02abf or nagf_complex_abs.
3
Description
The function evaluates by using where is the larger of and , and is the smaller of and . This ensures against unnecessary overflow and loss of accuracy when calculating .
4
References
Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag
5
Arguments
-
1:
– Real (Kind=nag_wp)
Input
-
2:
– Real (Kind=nag_wp)
Input
-
On entry: and , the real and imaginary parts of , respectively.
6
Error Indicators and Warnings
None.
7
Accuracy
The result should be correct to machine precision.
8
Parallelism and Performance
a02abf is not threaded in any implementation.
None.
10
Example
This example finds the modulus of .
10.1
Program Text
10.2
Program Data
10.3
Program Results