Doxygen Source Code Documentation
z_div.c File Reference
#include "f2c.h"
Go to the source code of this file.
Functions | |
void | sig_die (char *, int) |
void | z_div (doublecomplex *c, doublecomplex *a, doublecomplex *b) |
Function Documentation
|
Referenced by abort_(), c_div(), f__fatal(), op_gen(), rd_ed(), rd_ned(), s_rnge(), sigfdie(), sigidie(), sigindie(), sigtdie(), w_ed(), w_ned(), and z_div(). |
|
Definition at line 8 of file z_div.c. References a, c, and sig_die(). Referenced by pow_zi().
00010 { 00011 double ratio, den; 00012 double abr, abi; 00013 00014 if( (abr = b->r) < 0.) 00015 abr = - abr; 00016 if( (abi = b->i) < 0.) 00017 abi = - abi; 00018 if( abr <= abi ) 00019 { 00020 if(abi == 0) 00021 sig_die("complex division by zero", 1); 00022 ratio = b->r / b->i ; 00023 den = b->i * (1 + ratio*ratio); 00024 c->r = (a->r*ratio + a->i) / den; 00025 c->i = (a->i*ratio - a->r) / den; 00026 } 00027 00028 else 00029 { 00030 ratio = b->i / b->r ; 00031 den = b->r * (1 + ratio*ratio); 00032 c->r = (a->r + a->i*ratio) / den; 00033 c->i = (a->i - a->r*ratio) / den; 00034 } 00035 00036 } |