diff options
author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-30 18:39:35 +0000 |
---|---|---|
committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-30 18:39:35 +0000 |
commit | b346da947e88b1d38d24af9c0390a190c4060822 (patch) | |
tree | 2c79e9d2acec2b3d4d6cfbbfd54c0e6d55fcab57 /missing/hypot.c | |
parent | 11e886e6d6472e0ed13a2a31bc5eacf5eca4954a (diff) |
This commit was manufactured by cvs2svn to create branch 'ruby_1_6'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'missing/hypot.c')
-rw-r--r-- | missing/hypot.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/missing/hypot.c b/missing/hypot.c new file mode 100644 index 0000000000..aad5259e92 --- /dev/null +++ b/missing/hypot.c @@ -0,0 +1,17 @@ +/* public domain rewrite of hypot */ + +#include <math.h> + +double hypot(x,y) + double x, y; +{ + if (x < 0) x = -x; + if (y < 0) y = -y; + if (x < y) { + double tmp = x; + x = y; y = tmp; + } + if (y == 0.0) return x; + y /= x; + return x * sqrt(1.0+y*y); +} |