source: branches/libc-0.6/src/gcc/libf2c/libF77/cabs.c

Last change on this file was 1392, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 393 bytes
Line 
1#undef abs
2#include <math.h>
3double
4f__cabs (double real, double imag)
5{
6 double temp;
7
8 if (real < 0)
9 real = -real;
10 if (imag < 0)
11 imag = -imag;
12 if (imag > real)
13 {
14 temp = real;
15 real = imag;
16 imag = temp;
17 }
18 if ((real + imag) == real)
19 return (real);
20
21 temp = imag / real;
22 temp = real * sqrt (1.0 + temp * temp); /*overflow!! */
23 return (temp);
24}
Note: See TracBrowser for help on using the repository browser.