From a2ae1696f7c6cf269b3a734bce4d9d3620745854 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 13 Jun 2016 21:43:22 +0000 Subject: Fix dbl-64 atan2 (sNaN, qNaN) (bug 20252). The dbl-64 implementation of atan2, passed arguments (sNaN, qNaN), fails to raise the "invalid" exception. This patch fixes it to add both arguments, rather than just adding the second argument to itself, in the case where the second argument is a NaN (which is checked for before checking for the first argument being a NaN). sNaN tests for atan2 are added, along with some qNaN tests I noticed were missing but should have been there by analogy with other tests present. Tested for x86_64 and x86. [BZ #20252] * sysdeps/ieee754/dbl-64/e_atan2.c (__ieee754_atan2): Add both arguments when second argument is a NaN. * math/libm-test.inc (atan2_test_data): Add sNaN tests and more qNaN tests. --- sysdeps/ieee754/dbl-64/e_atan2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdeps/ieee754') diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c index 22e8fb8fef..0838907019 100644 --- a/sysdeps/ieee754/dbl-64/e_atan2.c +++ b/sysdeps/ieee754/dbl-64/e_atan2.c @@ -91,7 +91,7 @@ __ieee754_atan2 (double y, double x) if ((ux & 0x7ff00000) == 0x7ff00000) { if (((ux & 0x000fffff) | dx) != 0x00000000) - return x + x; + return x + y; } num.d = y; uy = num.i[HIGH_HALF]; -- cgit 1.4.1