added default hypot() implementation
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 9cff9e0..4e704bf 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -42,6 +42,27 @@
#if defined(HAVE_HYPOT) && !defined(NeXT)
extern double hypot PROTO((double, double));
+#else
+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);
+ }
+}
#endif
#ifdef i860
@@ -124,9 +145,7 @@
FUNC1(math_fabs, fabs)
FUNC1(math_floor, floor)
FUNC2(math_fmod, fmod)
-#ifdef HAVE_HYPOT
FUNC2(math_hypot, hypot)
-#endif
FUNC1(math_log, log)
FUNC1(math_log10, log10)
#ifdef MPW_3_1 /* This hack is needed for MPW 3.1 but not for 3.2 ... */
@@ -213,9 +232,7 @@
{"floor", math_floor},
{"fmod", math_fmod},
{"frexp", math_frexp},
-#ifdef HAVE_HYPOT
{"hypot", math_hypot},
-#endif
{"ldexp", math_ldexp},
{"log", math_log},
{"log10", math_log10},