]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix atan2 spurious exceptions (bug 11451).
authorJoseph Myers <joseph@codesourcery.com>
Mon, 19 Mar 2012 20:11:09 +0000 (20:11 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Mon, 19 Mar 2012 20:11:09 +0000 (20:11 +0000)
ChangeLog
NEWS
math/libm-test.inc
sysdeps/ieee754/dbl-64/e_atan2.c

index 0874b04fd9aafd649399eece57aeb91a18af854a..8ac195a49131cc1662f47c037ce768059d732fda 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-03-19  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #11451]
+       * sysdeps/ieee754/dbl-64/e_atan2.c (__ieee754_atan2): Scale large
+       x and y.
+       * math/libm-test.inc (atan2_test): Add another test.
+
        * Makerules (common-objdir-compile): Remove.
        * sysdeps/unix/Makefile (config-generated): Do not add
        $(unix-generated) to variable.
diff --git a/NEWS b/NEWS
index 5af4f68f060f0a2b7ba60fcdbbc11b2c24ee9e60..df8e1f03a6b47446990ca93dccf85939e5b446f2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,11 +12,11 @@ Version 2.16
   174, 350, 411, 2541, 2547, 2548, 2551, 2552, 2553, 2554, 2562, 2563, 2565,
   2566, 2576, 3335, 3976, 3992, 4026, 4108, 4596, 4822, 5077, 5461, 5805,
   5993, 6471, 6884, 6907, 6911, 9739, 9902, 10110, 10135, 10140, 10210,
-  10545, 10716, 11174, 11322, 11365, 11494, 12047, 13058, 13525, 13526,
-  13527, 13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551, 13552,
-  13553, 13555, 13559, 13566, 13583, 13618, 13637, 13656, 13658, 13673,
-  13695, 13704, 13706, 13726, 13738, 13786, 13792, 13806, 13840, 13841,
-  13844, 13846, 13851, 13852, 13854
+  10545, 10716, 11174, 11322, 11365, 11451, 11494, 12047, 13058, 13525,
+  13526, 13527, 13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551,
+  13552, 13553, 13555, 13559, 13566, 13583, 13618, 13637, 13656, 13658,
+  13673, 13695, 13704, 13706, 13726, 13738, 13786, 13792, 13806, 13840,
+  13841, 13844, 13846, 13851, 13852, 13854
 
 * ISO C11 support:
 
index 5638b76869c502620d027f98ed8db4f73bc67910..817864aeb20208b425f7b31fe7fe112aff7ac0ea 100644 (file)
@@ -949,6 +949,8 @@ atan2_test (void)
   TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
   TEST_ff_f (atan2, nan_value, nan_value, nan_value);
 
+  TEST_ff_f (atan2, max_value, max_value, M_PI_4l);
+
   TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
   TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
   TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
index dcef55f07272b098bcf5136ddb3aaa93a6d7ff4e..497afcab1e3834cebdfdcedfbce14de106b7a313 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * IBM Accurate Mathematical Library
  * written by International Business Machines Corp.
- * Copyright (C) 2001, 2011 Free Software Foundation
+ * Copyright (C) 2001-2012 Free Software Foundation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -153,6 +153,13 @@ __ieee754_atan2(double y,double x) {
   /* if either x or y is extremely close to zero, scale abs(x), abs(y). */
   if (ax<twom500.d || ay<twom500.d) { ax*=two500.d;  ay*=two500.d; }
 
+  /* Likewise for large x and y.  */
+  if (ax > two500.d || ay > two500.d)
+    {
+      ax *= twom500.d;
+      ay *= twom500.d;
+    }
+
   /* x,y which are neither special nor extreme */
   if (ay<ax) {
     u=ay/ax;