A02ABF (PDF version)
A02 Chapter Contents
A02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

A02ABF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

A02ABF returns the value of the modulus of the complex number x=xr,xi.

2  Specification

FUNCTION A02ABF ( XR, XI)
REAL (KIND=nag_wp) A02ABF
REAL (KIND=nag_wp)  XR, XI

3  Description

The function evaluates xr2+xi2 by using a1+ ba 2 where a is the larger of xr and xi, and b is the smaller of xr and xi. This ensures against unnecessary overflow and loss of accuracy when calculating xr2+xi2.

4  References

Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag

5  Parameters

1:     XR – REAL (KIND=nag_wp)Input
2:     XI – REAL (KIND=nag_wp)Input
On entry: xr and xi, the real and imaginary parts of x, respectively.

6  Error Indicators and Warnings

None.

7  Accuracy

The result should be correct to machine precision.

8  Parallelism and Performance

Not applicable.

9  Further Comments

None.

10  Example

This example finds the modulus of -1.7+2.6i.

10.1  Program Text

Program Text (a02abfe.f90)

10.2  Program Data

Program Data (a02abfe.d)

10.3  Program Results

Program Results (a02abfe.r)


A02ABF (PDF version)
A02 Chapter Contents
A02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015