public static cuDoubleComplex cuCdiv(cuDoubleComplex x,cuDoubleComplex y){
  cuDoubleComplex quot;
  double s=Math.abs(cuCreal(y)) + Math.abs(cuCimag(y));
  double oos=1.0 / s;
  double ars=cuCreal(x) * oos;
  double ais=cuCimag(x) * oos;
  double brs=cuCreal(y) * oos;
  double bis=cuCimag(y) * oos;
  s=(brs * brs) + (bis * bis);
  oos=1.0 / s;
  quot=cuCmplx(((ars * brs) + (ais * bis)) * oos,((ais * brs) - (ars * bis)) * oos);
  return quot;
}

public static cuDoubleComplex cuCdiv ( cuDoubleComplex x , cuDoubleComplex y ) { cuDoubleComplex quot ; double s = Math . abs ( cuCreal ( y ) ) + Math . abs ( cuCimag ( y ) ) ; double oos = 1.0 / s ; double ars = cuCreal ( x ) * oos ; double ais = cuCimag ( x ) * oos ; double brs = cuCreal ( y ) * oos ; double bis = cuCimag ( y ) * oos ; s = ( brs * brs ) + ( bis * bis ) ; oos = 1.0 / s ; quot = cuCmplx ( ( ( ars * brs ) + ( ais * bis ) ) * oos , ( ( ais * brs ) - ( ars * bis ) ) * oos ) ; return quot ; }
returns the quotient of the given complex numbers . < br / > < br / > original comment : < br / > < br / > this implementation guards against intermediate underflow and overflow by scaling . such guarded implementations are usually the default for complex library implementations , with some also offering an unguarded , faster version .
