From fdc6db4b7af14ce1ceb6e38e92135335a4921fa3 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Sat, 2 Aug 2014 15:46:50 -0700
Subject: [PATCH] Use fdlibm_atan instead of atan.

 * fdlibm.h:
   * Declare fdlibm_atan
 * e_atan2.c:
   * Use fdlibm_atan instead of atan.
---
 src/lisp/e_atan2.c | 4 ++--
 src/lisp/fdlibm.h  | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lisp/e_atan2.c b/src/lisp/e_atan2.c
index f4c1c1234..7e177e872 100644
--- a/src/lisp/e_atan2.c
+++ b/src/lisp/e_atan2.c
@@ -75,7 +75,7 @@ pi_lo   = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
 	if(((ix|((lx|-lx)>>31))>0x7ff00000)||
 	   ((iy|((ly|-ly)>>31))>0x7ff00000))	/* x or y is NaN */
 	   return x+y;
-	if((hx-0x3ff00000|lx)==0) return atan(y);   /* x=1.0 */
+	if((hx-0x3ff00000|lx)==0) return fdlibm_atan(y);   /* x=1.0 */
 	m = ((hy>>31)&1)|((hx>>30)&2);	/* 2*sign(x)+sign(y) */
 
     /* when y = 0 */
@@ -115,7 +115,7 @@ pi_lo   = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
 	k = (iy-ix)>>20;
 	if(k > 60) z=pi_o_2+0.5*pi_lo; 	/* |y/x| >  2**60 */
 	else if(hx<0&&k<-60) z=0.0; 	/* |y|/x < -2**60 */
-	else z=atan(fabs(y/x));		/* safe to do y/x */
+	else z=fdlibm_atan(fabs(y/x));		/* safe to do y/x */
 	switch (m) {
 	    case 0: return       z  ;	/* atan(+,+) */
 	    case 1: 
diff --git a/src/lisp/fdlibm.h b/src/lisp/fdlibm.h
index 72f57f823..9d256646c 100644
--- a/src/lisp/fdlibm.h
+++ b/src/lisp/fdlibm.h
@@ -53,6 +53,7 @@ extern double fdlibm_cos(double x);
 extern double fdlibm_tan(double x);
 extern double fdlibm_expm1(double x);
 extern double fdlibm_log1p(double x);
+extern double fdlibm_atan(double x);
 extern double __ieee754_exp(double x);
 extern double __ieee754_log(double x);
 
-- 
GitLab