| 74 | { return ap::complex(lhs*rhs.x, lhs*rhs.y); } |
| 75 | |
| 76 | const ap::complex ap::operator/(const ap::complex& lhs, const ap::complex& rhs) |
| 77 | { |
| 78 | ap::complex result; |
| 79 | double e; |
| 80 | double f; |
| 81 | if( fabs(rhs.y)<fabs(rhs.x) ) |
| 82 | { |
| 83 | e = rhs.y/rhs.x; |
| 84 | f = rhs.x+rhs.y*e; |
| 85 | result.x = (lhs.x+lhs.y*e)/f; |
| 86 | result.y = (lhs.y-lhs.x*e)/f; |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | e = rhs.x/rhs.y; |
| 91 | f = rhs.y+rhs.x*e; |
| 92 | result.x = (lhs.y+lhs.x*e)/f; |
| 93 | result.y = (-lhs.x+lhs.y*e)/f; |
| 94 | } |
| 95 | return result; |
| 96 | } |
| 97 | |
| 98 | const ap::complex ap::operator/(const double& lhs, const ap::complex& rhs) |
| 99 | { |