1 /* public domain rewrite of hypot */
2
3 #include <math.h>
4
5 double hypot(x,y)
6 double x, y;
7 {
8 if (x < 0) x = -x;
9 if (y < 0) y = -y;
10 if (x < y) {
11 double tmp = x;
12 x = y; y = tmp;
13 }
14 if (y == 0.0) return x;
15 y /= x;
16 return x * sqrt(1.0+y*y);
17 }