Catch situations where currentframe() returns None. See SF patch #1447410, this is...
[python.git] / Python / hypot.c
blob755d0c31c8ef93fb4932d153b838bea5b7d63a3d
1 /* hypot() replacement */
3 #include "pyconfig.h"
4 #include "pyport.h"
6 double hypot(double x, double y)
8 double yx;
10 x = fabs(x);
11 y = fabs(y);
12 if (x < y) {
13 double temp = x;
14 x = y;
15 y = temp;
17 if (x == 0.)
18 return 0.;
19 else {
20 yx = y/x;
21 return x*sqrt(1.+yx*yx);