diff options
author | dannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-21 00:51:24 +0000 |
---|---|---|
committer | dannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-21 00:51:24 +0000 |
commit | 86d364ccd1c6f478c0774d9128efb2b2055be3c4 (patch) | |
tree | a6b1c2be1ef14319f9648004696ee011b0addc18 /libstdc++-v3/libmath | |
parent | 0da6cf03dfa46b0ff3d61fb76c48827e048946cd (diff) | |
download | gcc-86d364ccd1c6f478c0774d9128efb2b2055be3c4.tar.gz |
* libmath/stubs.c (hypot, hypotf, hypotl): Don't divide by
zero.
Update copyright year.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67051 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/libmath')
-rw-r--r-- | libstdc++-v3/libmath/stubs.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libstdc++-v3/libmath/stubs.c b/libstdc++-v3/libmath/stubs.c index 586fd6db80e..1968bffe7f9 100644 --- a/libstdc++-v3/libmath/stubs.c +++ b/libstdc++-v3/libmath/stubs.c @@ -1,6 +1,6 @@ /* 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 @@ -108,6 +108,8 @@ float 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); } @@ -118,6 +120,8 @@ double 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); } @@ -128,6 +132,8 @@ long double 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); } |