Gitiles
Code Review
Sign In
gerrit-public.fairphone.software
/
platform
/
external
/
python
/
cpython3
/
5c10664043448f1d27d7ce7eb67c2afe3f54b018
/
.
/
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
);
}
}