A02 Chapter Contents
A02 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentA02ACF

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.

## 1  Purpose

A02ACF divides one complex number, $x=\left({x}_{r},{x}_{i}\right)$, by a second complex number, $y=\left({y}_{r},{y}_{i}\right)$, returning the result in $z=\left({z}_{r},{z}_{i}\right)$.

## 2  Specification

 SUBROUTINE A02ACF ( XR, XI, YR, YI, ZR, ZI)
 REAL (KIND=nag_wp) XR, XI, YR, YI, ZR, ZI

## 3  Description

The result $z$ is calculated using Smith's algorithm with scaling, from Li et al. (2002), which ensures that no unnecessary overflow or underflow occurs at intermediate stages of the computation.

## 4  References

Li X S, Demmel J W, Bailey D H, Henry G, Hida Y, Iskandar J, Kahan W, Kapur A, Martin M C, Tung T and Yoo D J (2002) Design, implementation and testing of extended and mixed precision BLAS ACM Trans. Math. Soft. 28(2) 152–205

## 5  Parameters

1:     XR – REAL (KIND=nag_wp)Input
2:     XI – REAL (KIND=nag_wp)Input
On entry: ${x}_{r}$ and ${x}_{i}$, the real and imaginary parts of $x$, respectively.
3:     YR – REAL (KIND=nag_wp)Input
4:     YI – REAL (KIND=nag_wp)Input
On entry: ${y}_{r}$ and ${y}_{i}$, the real and imaginary parts of $y$, respectively.
5:     ZR – REAL (KIND=nag_wp)Output
6:     ZI – REAL (KIND=nag_wp)Output
On exit: ${z}_{r}$ and ${z}_{i}$, the real and imaginary parts of $z$, respectively.

None.

## 7  Accuracy

The result should be correct to machine precision.

The time taken by A02ACF is negligible.
This routine must not be called with ${\mathbf{YR}}=0.0$ and ${\mathbf{YI}}=0.0$.

## 9  Example

This example finds the value of $\left(-1.7+2.6i\right)/\left(-3.1-0.9i\right)$.

### 9.1  Program Text

Program Text (a02acfe.f90)

### 9.2  Program Data

Program Data (a02acfe.d)

### 9.3  Program Results

Program Results (a02acfe.r)