| 41 | #undef abs |
| 42 | |
| 43 | double f__cabsf(float real, float imag) |
| 44 | #endif |
| 45 | { |
| 46 | float temp; |
| 47 | |
| 48 | if(real < 0.0f) |
| 49 | real = -real; |
| 50 | if(imag < 0.0f) |
| 51 | imag = -imag; |
| 52 | if(imag > real){ |
| 53 | temp = real; |
| 54 | real = imag; |
| 55 | imag = temp; |
| 56 | } |
| 57 | if((imag+real) == real) |
| 58 | return((float)real); |
| 59 | |
| 60 | temp = imag/real; |
| 61 | temp = real*sqrtf(1.0 + temp*temp); /*overflow!!*/ |
| 62 | return(temp); |
| 63 | } |
| 64 | |
| 65 | |
| 66 | #ifdef KR_headers |