Fix atan2 spurious exceptions (bug 11451).

This commit is contained in:
Joseph Myers 2012-03-19 20:11:09 +00:00
parent 83d1aec8fc
commit 7726d6a95d
4 changed files with 20 additions and 6 deletions

View File

@ -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.

10
NEWS
View File

@ -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:

View 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);

View 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;