]> granicus.if.org Git - python/commitdiff
*** empty log message ***
authorGuido van Rossum <guido@python.org>
Thu, 29 Aug 1996 18:10:41 +0000 (18:10 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 29 Aug 1996 18:10:41 +0000 (18:10 +0000)
Python/hypot.c [new file with mode: 0644]

diff --git a/Python/hypot.c b/Python/hypot.c
new file mode 100644 (file)
index 0000000..293aeb8
--- /dev/null
@@ -0,0 +1,26 @@
+/* hypot() replacement */
+
+#include "config.h"
+#include "myproto.h"
+#include "mymath.h"
+
+double hypot(x, y)
+       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);
+       }
+}