[git] CMU Common Lisp branch master updated. snapshot-2014-06-4-g1b9697d
Raymond Toy
rtoy at common-lisp.net
Mon Jul 21 04:00:56 UTC 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".
The branch, master has been updated
via 1b9697d7923b1e9f7d875b94a13e427ddc651453 (commit)
from da059a86b5eca795f157ca85e74520a76ab5207f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1b9697d7923b1e9f7d875b94a13e427ddc651453
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Sun Jul 20 21:00:47 2014 -0700
Update to use unions, using the style of e_rem_pio2.c.
diff --git a/src/lisp/k_cos.c b/src/lisp/k_cos.c
index 7fb855d..2be76e0 100644
--- a/src/lisp/k_cos.c
+++ b/src/lisp/k_cos.c
@@ -70,7 +70,10 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */
{
double a,hz,z,r,qx;
int ix;
- ix = __HI(x)&0x7fffffff; /* ix = |x|'s high word*/
+ union { int i[2]; double d; } ux;
+
+ ux.d = x;
+ ix = ux.i[HIWORD]&0x7fffffff; /* ix = |x|'s high word*/
if(ix<0x3e400000) { /* if x < 2**27 */
if(((int)x)==0) return one; /* generate inexact */
}
@@ -82,8 +85,9 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */
if(ix > 0x3fe90000) { /* x > 0.78125 */
qx = 0.28125;
} else {
- __HI(qx) = ix-0x00200000; /* x/4 */
- __LO(qx) = 0;
+ ux.i[HIWORD] = ix-0x00200000;
+ ux.i[LOWORD] = 0;
+ qx = ux.d;
}
hz = 0.5*z-qx;
a = one-qx;
diff --git a/src/lisp/k_sin.c b/src/lisp/k_sin.c
index dfcad76..dd660af 100644
--- a/src/lisp/k_sin.c
+++ b/src/lisp/k_sin.c
@@ -63,7 +63,10 @@ S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */
{
double z,r,v;
int ix;
- ix = __HI(x)&0x7fffffff; /* high word of x */
+ union { int i[2]; double d; } ux;
+
+ ux.d = x;
+ ix = ux.i[HIWORD]&0x7fffffff; /* high word of x */
if(ix<0x3e400000) /* |x| < 2**-27 */
{if((int)x==0) return x;} /* generate inexact */
z = x*x;
diff --git a/src/lisp/k_tan.c b/src/lisp/k_tan.c
index 017c1e5..10fa562 100644
--- a/src/lisp/k_tan.c
+++ b/src/lisp/k_tan.c
@@ -1,5 +1,3 @@
-#pragma ident "@(#)k_tan.c 1.5 04/04/22 SMI"
-
/*
* ====================================================
* Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
@@ -74,12 +72,14 @@ double
__kernel_tan(double x, double y, int iy) {
double z, r, v, w, s;
int ix, hx;
+ union { int i[2]; double d; } ux,uz;
- hx = __HI(x); /* high word of x */
+ ux.d = x;
+ hx = ux.i[HIWORD]; /* high word of x */
ix = hx & 0x7fffffff; /* high word of |x| */
if (ix < 0x3e300000) { /* x < 2**-28 */
if ((int) x == 0) { /* generate inexact */
- if (((ix | __LO(x)) | (iy + 1)) == 0)
+ if (((ix | ux.i[LOWORD]) | (iy + 1)) == 0)
return one / fabs(x);
else {
if (iy == 1)
@@ -88,10 +88,16 @@ __kernel_tan(double x, double y, int iy) {
double a, t;
z = w = x + y;
- __LO(z) = 0;
+ uz.d = z;
+ uz.i[LOWORD] = 0;
+ z = ux.d;
+
v = y - (z - x);
t = a = -one / w;
- __LO(t) = 0;
+ uz.d = t;
+ uz.i[LOWORD] = 0;
+ t = uz.d;
+
s = one + t * z;
return t + a * (s + t * v);
}
@@ -138,10 +144,14 @@ __kernel_tan(double x, double y, int iy) {
/* compute -1.0 / (x+r) accurately */
double a, t;
z = w;
- __LO(z) = 0;
+ uz.d = z;
+ uz.i[LOWORD] = 0;
+ z = uz.d;
v = r - (z - x); /* z+v = r+x */
t = a = -1.0 / w; /* a = -1.0/w */
- __LO(t) = 0;
+ uz.d = t;
+ uz.i[LOWORD] = 0;
+ t = uz.d;
s = 1.0 + t * z;
return t + a * (s + t * v);
}
diff --git a/src/lisp/s_cos.c b/src/lisp/s_cos.c
index 3bab516..a897133 100644
--- a/src/lisp/s_cos.c
+++ b/src/lisp/s_cos.c
@@ -53,9 +53,12 @@
{
double y[2],z=0.0;
int n, ix;
+ union { int i[2]; double d; } ux;
/* High word of x. */
- ix = __HI(x);
+ ux.d = x;
+ ix = ux.i[HIWORD];
+
/* |x| ~< pi/4 */
ix &= 0x7fffffff;
diff --git a/src/lisp/s_sin.c b/src/lisp/s_sin.c
index 43394e5..1dba1c8 100644
--- a/src/lisp/s_sin.c
+++ b/src/lisp/s_sin.c
@@ -53,9 +53,11 @@
{
double y[2],z=0.0;
int n, ix;
-
+ union { int i[2]; double d; } ux;
+
/* High word of x. */
- ix = __HI(x);
+ ux.d = x;
+ ix = ux.i[HIWORD];
/* |x| ~< pi/4 */
ix &= 0x7fffffff;
diff --git a/src/lisp/s_tan.c b/src/lisp/s_tan.c
index 1f5564b..4761a4c 100644
--- a/src/lisp/s_tan.c
+++ b/src/lisp/s_tan.c
@@ -52,9 +52,11 @@
{
double y[2],z=0.0;
int n, ix;
+ union { int i[2]; double d; } ux;
/* High word of x. */
- ix = __HI(x);
+ ux.d = x;
+ ix = ux.i[HIWORD];
/* |x| ~< pi/4 */
ix &= 0x7fffffff;
-----------------------------------------------------------------------
Summary of changes:
src/lisp/k_cos.c | 10 +++++++---
src/lisp/k_sin.c | 5 ++++-
src/lisp/k_tan.c | 26 ++++++++++++++++++--------
src/lisp/s_cos.c | 5 ++++-
src/lisp/s_sin.c | 6 ++++--
src/lisp/s_tan.c | 4 +++-
6 files changed, 40 insertions(+), 16 deletions(-)
hooks/post-receive
--
CMU Common Lisp
More information about the cmucl-cvs
mailing list