repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2001-08-03 Daniel Berlin <dan@cgsoftware.com>
[official-gcc.git]
/
libf2c
/
libF77
/
cabs.c
blob
2fad044e884081c0cee7f0a3f35a67e7f78949da
1
#ifdef KR_headers
2
extern
double
sqrt
();
3
double
f__cabs
(
real
,
imag
)
double
real
,
imag
;
4
#else
5
#undef abs
6
#include <math.h>
7
double
f__cabs
(
double
real
,
double
imag
)
8
#endif
9
{
10
double
temp
;
11
12
if
(
real
<
0
)
13
real
= -
real
;
14
if
(
imag
<
0
)
15
imag
= -
imag
;
16
if
(
imag
>
real
){
17
temp
=
real
;
18
real
=
imag
;
19
imag
=
temp
;
20
}
21
if
((
real
+
imag
) ==
real
)
22
return
(
real
);
23
24
temp
=
imag
/
real
;
25
temp
=
real
*
sqrt
(
1.0
+
temp
*
temp
);
/*overflow!!*/
26
return
(
temp
);
27
}