1 /* ./src_f77/sladiv.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
sladiv_(real * a,real * b,real * c__,real * d__,real * p,real * q)8 /* Subroutine */ int sladiv_(real *a, real *b, real *c__, real *d__, real *p,
9 real *q)
10 {
11 static real 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 /* SLADIV 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) REAL */
38 /* B (input) REAL */
39 /* C (input) REAL */
40 /* D (input) REAL */
41 /* The scalars a, b, c, and d in the above expression. */
42
43 /* P (output) REAL */
44 /* Q (output) REAL */
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 (dabs(*d__) < dabs(*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 SLADIV */
70
71 } /* sladiv_ */
72
73