Gitiles
Code Review
Sign In
gerrit-public.fairphone.software
/
platform
/
external
/
python
/
cpython3
/
ad3562ed631677a3f92a3b75259d96749c1927ac
/
.
/
Python
/
hypot.c
blob: 9d3c0d0bac3722af423a8000731e8d96d2458a5f [
file
] [
log
] [
blame
]
/* hypot() replacement */
#include
"Python.h"
double
hypot
(
double
x
,
double
y
)
{
double
yx
;
x
=
fabs
(
x
);
y
=
fabs
(
y
);
if
(
x
<
y
)
{
double
temp
=
x
;
x
=
y
;
y
=
temp
;
}
if
(
x
==
0.
)
return
0.
;
else
{
yx
=
y
/
x
;
return
x
*
sqrt
(
1.
+
yx
*
yx
);
}
}