/* * ------------------------------------------------------------------------- * convertcomplex.c -- definition of the function to convert complex numbers * from (a + jb) to (r exp(j phi)) * ------------------------------------------------------------------------- */ #include "convertcomplex.h" /* * ------------------------------------------------------------------------- * Calculate magnitude and angle and return a new struct with these elements * ------------------------------------------------------------------------- */ EULER complexToEuler ( COMPLEX cxOperand ){ EULER euConverted; euConverted.fMagn = sqrt( cxOperand.fReal * cxOperand.fReal + cxOperand.fImag * cxOperand.fImag ); euConverted.fAngle = (float) atan2 ( cxOperand.fImag, cxOperand.fReal ); return euConverted; }