 
 /**/
 /* coded so as not to assume r4000 processor or to assume that*/
 /* component parts are 8 byte aligned*/
 /**/
 /*%externalroutine    Ccdiv %alias "f_ccdiv" (%record(cxf)%name c,a,b)*/
 /*%longreal ratio, den, abr, abi*/
 /*      abr = b_real*/
 /*      %if abr  < 0.0 %then abr = 0.0 - abr*/
 /*      abi = b_imag*/
 /*      %if abi < 0.0 %then abi = 0.0 - abi*/
 /*      %if abr <= abi %start*/
 /*        ratio = b_real / b_imag*/
 /*        den   = b_imag * (1 + ratio*ratio)*/
 /*        c_real= (a_real*ratio + a_imag) / den*/
 /*        c_imag= (a_imag*ratio - a_real) / den*/
 /*      %finishelsestart*/
 /*        ratio = b_imag / b_real*/
 /*        den   = b_real * (1 + ratio*ratio)*/
 /*        c_real= (a_real + a_imag*ratio) / den*/
 /*        c_imag= (a_imag - a_real*ratio) / den*/
 /*      %finish*/
 /**/

void f_lccdiv(float ar, float ai, float br, float bi) {
  float ratio,den,cr,ci,abr,abi;

  abr = br;
  if ( abr  < 0.0) abr = 0.0 - abr;
  abi = bi;
  if (abi < 0.0) abi = 0.0 - abi;
  if (abr <= abi) {
    ratio = br/bi;
    den = bi*(1 + ratio*ratio);
    cr = (ar*ratio+ai)/den;
    ci = (ai*ratio-ai)/den;
  } else {
    ratio = bi/br;
    den = br * (1 + ratio*ratio);
    cr = (ar+ai*ratio)/den;
    ci = (ai-ar*ratio)/den;
  }
}
