KTH framework for Nek5000 toolboxes; testing version  0.0.1
dladiv.f
Go to the documentation of this file.
1  SUBROUTINE dladiv( A, B, C, D, P, Q )
2 *
3 * -- LAPACK auxiliary routine (version 3.0) --
4 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5 * Courant Institute, Argonne National Lab, and Rice University
6 * October 31, 1992
7 *
8 * .. Scalar Arguments ..
9  DOUBLE PRECISION A, B, C, D, P, Q
10 * ..
11 *
12 * Purpose
13 * =======
14 *
15 * DLADIV performs complex division in real arithmetic
16 *
17 * a + i*b
18 * p + i*q = ---------
19 * c + i*d
20 *
21 * The algorithm is due to Robert L. Smith and can be found
22 * in D. Knuth, The art of Computer Programming, Vol.2, p.195
23 *
24 * Arguments
25 * =========
26 *
27 * A (input) DOUBLE PRECISION
28 * B (input) DOUBLE PRECISION
29 * C (input) DOUBLE PRECISION
30 * D (input) DOUBLE PRECISION
31 * The scalars a, b, c, and d in the above expression.
32 *
33 * P (output) DOUBLE PRECISION
34 * Q (output) DOUBLE PRECISION
35 * The scalars p and q in the above expression.
36 *
37 * =====================================================================
38 *
39 * .. Local Scalars ..
40  DOUBLE PRECISION E, F
41 * ..
42 * .. Intrinsic Functions ..
43  INTRINSIC abs
44 * ..
45 * .. Executable Statements ..
46 *
47  IF( abs( d ).LT.abs( c ) ) THEN
48  e = d / c
49  f = c + d*e
50  p = ( a+b*e ) / f
51  q = ( b-a*e ) / f
52  ELSE
53  e = c / d
54  f = d + c*e
55  p = ( b+a*e ) / f
56  q = ( -a+b*e ) / f
57  END IF
58 *
59  RETURN
60 *
61 * End of DLADIV
62 *
63  END
subroutine dladiv(A, B, C, D, P, Q)
Definition: dladiv.f:2