Ruby
3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
missing
hypot.c
Go to the documentation of this file.
1
/* public domain rewrite of hypot */
2
3
#include "
ruby/missing.h
"
4
#include <
math.h
>
5
6
double
hypot
(
double
x,
double
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
}
hypot
double hypot(double x, double y)
Definition:
hypot.c:6
missing.h
Prototype for *.c in ./missing, and for missing timeval struct.
math.h
Internal header for Math.
Generated by
1.9.5