Fix hypotl to C99 specification.

Fix hypotl to return +infinity when either component is an infinity, even
when the other is NaN, as specified in Annex F.9.4.3 of C99-TC3.

mingw-w64-crt/ChangeLog:
2010-06-27  Doug Semler <dougsemler@gmail.com>

	* math/hypotl (hypotl): Return +infinity when either of the inputs
	  is an infinity, including when the other is NaN (Annex F.9.4.3)

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@2668 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/ChangeLog b/mingw-w64-crt/ChangeLog
index c12e1a4..f6069f4 100644
--- a/mingw-w64-crt/ChangeLog
+++ b/mingw-w64-crt/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-27  Doug Semler <dougsemler@gmail.com>
+
+	* math/hypotl (hypotl): Return +infinity when either of the inputs
+	  is an infinity, including when the other is NaN (Annex F.9.4.3)
+
 2010-06-27  Kai Tietz  <kai.tietz@onevision.com>
 
 	* lib32/pdh.def: New.
diff --git a/mingw-w64-crt/math/hypotl.c b/mingw-w64-crt/math/hypotl.c
index f62c249..de1796c 100644
--- a/mingw-w64-crt/math/hypotl.c
+++ b/mingw-w64-crt/math/hypotl.c
@@ -35,7 +35,12 @@
   long double xx =fabsl(x);
   long double yy =fabsl(y);
   if (!isfinite(xx) || !isfinite(yy))
-    return  xx + yy; /* Return INF or NAN. */
+    {
+      /* Annex F.9.4.3, hypot returns +infinity if
+         either component is an infinity, even when the
+         other compoent is NaN.  */
+      return (isinf(xx) || isinf(yy)) ? INFINITY : NAN;
+    }
 
   if (xx == 0.0L)
      return yy;