repo.or.cz
/
ruby.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
[ruby/prism] Fix a token incompatibility for `Prism::Translation::Parser::Lexer`
[ruby.git]
/
missing
/
hypot.c
blob
765581bacb154da2d4643eefb39973d4664dc35e
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
}