about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-04-08 17:14:12 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-04-08 17:14:12 +0000
commitae63c7ebedcaa57017df4cb8ff0494a4705321ee (patch)
tree4f2b413430bffe2a9c5354c5bd4e731106d7b832 /sysdeps/ieee754/dbl-64
parentd5856d06c3ef62907f2865c502ada4baf3c9efa1 (diff)
downloadglibc-ae63c7ebedcaa57017df4cb8ff0494a4705321ee.tar.gz
glibc-ae63c7ebedcaa57017df4cb8ff0494a4705321ee.tar.xz
glibc-ae63c7ebedcaa57017df4cb8ff0494a4705321ee.zip
Fix dbl-64 atan in non-default rounding modes (bug 18197).
The dbl-64 implementation of atan does computations that expect to run
in round-to-nearest mode, and in other modes the errors can accumulate
to more than the maximum accepted 9ulp.  This patch makes it use
FE_TONEAREST internally, similar to other functions with such issues.

Tested for x86_64 and x86; no ulps updates needed.

	[BZ #18197]
	* sysdeps/ieee754/dbl-64/s_atan.c: Include <fenv.h>.
	(atan): Set FE_TONEAREST mode for internal computations.
	* math/auto-libm-test-in: Add more tests of atan.
	* math/auto-libm-test-out: Regenerated.
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r--sysdeps/ieee754/dbl-64/s_atan.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_atan.c b/sysdeps/ieee754/dbl-64/s_atan.c
index 7b598f14a9..5035ae87bc 100644
--- a/sysdeps/ieee754/dbl-64/s_atan.c
+++ b/sysdeps/ieee754/dbl-64/s_atan.c
@@ -41,6 +41,7 @@
 #include "MathLib.h"
 #include "uatan.tbl"
 #include "atnat.h"
+#include <fenv.h>
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
@@ -81,6 +82,7 @@ atan (double x)
     return x + x;
 
   /* Regular values of x, including denormals +-0 and +-INF */
+  SET_RESTORE_ROUND (FE_TONEAREST);
   u = (x < 0) ? -x : x;
   if (u < C)
     {