This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/2] Consolidate condition check for return value in mp asin and acos


On Fri, Oct 25, 2013 at 06:48:21PM +0530, Siddhesh Poyarekar wrote:
> On 25 October 2013 18:16, Allan McRae <allan@archlinux.org> wrote:
> > You are doing more than add the probe here.  I would have thought that
> > clean-up would need to be a separate patch, or at least have a ChangeLog
> > entry.
> 
> OK, I'll split it up in my next iteration.


So this is part one of the patch which consolidates the conditionals
in the return of __sin32 and __cos32 to prepare the code for sstemtap
probes.

Siddhesh

	* sysdeps/ieee754/dbl-64/sincos32.c (__sin32): Consolidate
	conditional check for return value.
	(__cos32): Likewise.

diff --git a/sysdeps/ieee754/dbl-64/sincos32.c b/sysdeps/ieee754/dbl-64/sincos32.c
index f253b8c..11654d6 100644
--- a/sysdeps/ieee754/dbl-64/sincos32.c
+++ b/sysdeps/ieee754/dbl-64/sincos32.c
@@ -147,10 +147,9 @@ __sin32 (double x, double res, double res1)
   __dbl_mp (x, &c, p);		/* c = x  */
   __sub (&b, &c, &a, p);
   /* if a > 0 return min (res, res1), otherwise return max (res, res1).  */
-  if (a.d[0] > 0)
-    return (res < res1) ? res : res1;
-  else
-    return (res > res1) ? res : res1;
+  if ((a.d[0] > 0 && res > res1) || (a.d[0] <= 0 && res < res1))
+    res = res1;
+  return res;
 }
 
 /* Receive double x and two double results of cos(x) and return result which is
@@ -181,10 +180,9 @@ __cos32 (double x, double res, double res1)
   __dbl_mp (x, &c, p);		/* c = x                  */
   __sub (&b, &c, &a, p);
   /* if a > 0 return max (res, res1), otherwise return min (res, res1).  */
-  if (a.d[0] > 0)
-    return (res > res1) ? res : res1;
-  else
-    return (res < res1) ? res : res1;
+  if ((a.d[0] > 0 && res < res1) || (a.d[0] <= 0 && res > res1))
+    res = res1;
+  return res;
 }
 
 /* Compute sin() of double-length number (X + DX) as Multi Precision number and


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]