+2003-05-21 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * libmath/stubs.c (hypot, hypotf, hypotl): Don't divide by
+ zero.
+ Update copyright year.
+
2003-05-20 Paolo Carlini <pcarlini@unitus.it>
* testsuite/27_io/basic_filebuf/close/char/4.cc: Fix typo.
/* Stub definitions for libmath subpart of libstdc++. */
-/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU ISO C++ Library. This library is free
software; you can redistribute it and/or modify it under the
hypotf(float x, float y)
{
float s = fabsf(x) + fabsf(y);
+ if (s == 0.0F)
+ return s;
x /= s; y /= s;
return s * sqrtf(x * x + y * y);
}
hypot(double x, double y)
{
double s = fabs(x) + fabs(y);
+ if (s == 0.0)
+ return s;
x /= s; y /= s;
return s * sqrt(x * x + y * y);
}
hypotl(long double x, long double y)
{
long double s = fabsl(x) + fabsl(y);
+ if (s == 0.0L)
+ return s;
x /= s; y /= s;
return s * sqrtl(x * x + y * y);
}