Skip to content

Commit

Permalink
Consolidate conditionals in mp sin/cos functions
Browse files Browse the repository at this point in the history
Consolidate conditionals in multiple precision sin and cos functions
to prepare the code for addition of probe points.
  • Loading branch information
Siddhesh Poyarekar committed Oct 28, 2013
1 parent 67beb54 commit c79a120
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2013-10-28 Siddhesh Poyarekar <siddhesh@redhat.com>

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

2013-10-26 Adhemerval Zanella <azanella@linux.vnet.ibm.com>

* sysdeps/powerpc/powerpc64/strcpy.S (strcpy): Add word load/store
Expand Down
14 changes: 6 additions & 8 deletions sysdeps/ieee754/dbl-64/sincos32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c79a120

Please sign in to comment.