* stor-layout.c (place_field): Revert erroneous commit.
[official-gcc.git] / libf2c / libF77 / z_div.c
bloba5fc527bdc2af5bb55144200465bdaf3767ce6ad
1 #include "f2c.h"
3 extern void sig_die (char *, int);
4 void
5 z_div (doublecomplex * c, doublecomplex * a, doublecomplex * b)
7 double ratio, den;
8 double abr, abi, cr;
10 if ((abr = b->r) < 0.)
11 abr = -abr;
12 if ((abi = b->i) < 0.)
13 abi = -abi;
14 if (abr <= abi)
16 if (abi == 0)
18 #ifdef IEEE_COMPLEX_DIVIDE
19 if (a->i != 0 || a->r != 0)
20 abi = 1.;
21 c->i = c->r = abi / abr;
22 return;
23 #else
24 sig_die ("complex division by zero", 1);
25 #endif
27 ratio = b->r / b->i;
28 den = b->i * (1 + ratio * ratio);
29 cr = (a->r * ratio + a->i) / den;
30 c->i = (a->i * ratio - a->r) / den;
33 else
35 ratio = b->i / b->r;
36 den = b->r * (1 + ratio * ratio);
37 cr = (a->r + a->i * ratio) / den;
38 c->i = (a->i - a->r * ratio) / den;
40 c->r = cr;