Debian Codegraph @

external/gsl/gsl_cblas__hypot.c

raw
1 #include <math.h>
2
3 static double xhypot (const double x, const double y);
4
5 static double xhypot (const double x, const double y)
6 {
7 double xabs = fabs(x) ;
8 double yabs = fabs(y) ;
9 double min, max;
10
11 if (xabs < yabs) {
12 min = xabs ;
13 max = yabs ;
14 } else {
15 min = yabs ;
16 max = xabs ;
17 }
18
19 if (min == 0)
20 {
21 return max ;
22 }
23
24 {
25 double u = min / max ;
26 return max * sqrt (1 + u * u) ;
27 }
28 }