From 7726d6a95d5a2c08c8d43186002f040b9b889c27 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 19 Mar 2012 20:11:09 +0000 Subject: [PATCH] Fix atan2 spurious exceptions (bug 11451). --- ChangeLog | 5 +++++ NEWS | 10 +++++----- math/libm-test.inc | 2 ++ sysdeps/ieee754/dbl-64/e_atan2.c | 9 ++++++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0874b04..8ac195a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2012-03-19 Joseph Myers + [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 5af4f68..df8e1f0 100644 --- 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: diff --git a/math/libm-test.inc b/math/libm-test.inc index 5638b76..817864a 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -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); diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c index dcef55f..497afca 100644 --- a/sysdeps/ieee754/dbl-64/e_atan2.c +++ b/sysdeps/ieee754/dbl-64/e_atan2.c @@ -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 two500.d || ay > two500.d) + { + ax *= twom500.d; + ay *= twom500.d; + } + /* x,y which are neither special nor extreme */ if (ay