1 /* ./src_f77/dladiv.f -- translated by f2c (version 20030320).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include <punc/vf2c.h>
7
dladiv_(doublereal * a,doublereal * b,doublereal * c__,doublereal * d__,doublereal * p,doublereal * q)8 /* Subroutine */ int dladiv_(doublereal *a, doublereal *b, doublereal *c__,
9 doublereal *d__, doublereal *p, doublereal *q)
10 {
11 static doublereal e, f;
12
13
14 /* -- LAPACK auxiliary routine (version 3.0) -- */
15 /* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
16 /* Courant Institute, Argonne National Lab, and Rice University */
17 /* October 31, 1992 */
18
19 /* .. Scalar Arguments .. */
20 /* .. */
21
22 /* Purpose */
23 /* ======= */
24
25 /* DLADIV performs complex division in real arithmetic */
26
27 /* a + i*b */
28 /* p + i*q = --------- */
29 /* c + i*d */
30
31 /* The algorithm is due to Robert L. Smith and can be found */
32 /* in D. Knuth, The art of Computer Programming, Vol.2, p.195 */
33
34 /* Arguments */
35 /* ========= */
36
37 /* A (input) DOUBLE PRECISION */
38 /* B (input) DOUBLE PRECISION */
39 /* C (input) DOUBLE PRECISION */
40 /* D (input) DOUBLE PRECISION */
41 /* The scalars a, b, c, and d in the above expression. */
42
43 /* P (output) DOUBLE PRECISION */
44 /* Q (output) DOUBLE PRECISION */
45 /* The scalars p and q in the above expression. */
46
47 /* ===================================================================== */
48
49 /* .. Local Scalars .. */
50 /* .. */
51 /* .. Intrinsic Functions .. */
52 /* .. */
53 /* .. Executable Statements .. */
54
55 if (abs(*d__) < abs(*c__)) {
56 e = *d__ / *c__;
57 f = *c__ + *d__ * e;
58 *p = (*a + *b * e) / f;
59 *q = (*b - *a * e) / f;
60 } else {
61 e = *c__ / *d__;
62 f = *d__ + *c__ * e;
63 *p = (*b + *a * e) / f;
64 *q = (-(*a) + *b * e) / f;
65 }
66
67 return 0;
68
69 /* End of DLADIV */
70
71 } /* dladiv_ */
72
73