Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
9adcb02d
Commit
9adcb02d
authored
10 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Use unions to access the high and low parts of a double.
parent
359d84fb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/lisp/e_acos.c
+8
-3
8 additions, 3 deletions
src/lisp/e_acos.c
src/lisp/e_asin.c
+8
-3
8 additions, 3 deletions
src/lisp/e_asin.c
src/lisp/s_atan.c
+6
-4
6 additions, 4 deletions
src/lisp/s_atan.c
with
22 additions
and
10 deletions
src/lisp/e_acos.c
+
8
−
3
View file @
9adcb02d
...
@@ -66,10 +66,13 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
...
@@ -66,10 +66,13 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
{
{
double
z
,
p
,
q
,
r
,
w
,
s
,
c
,
df
;
double
z
,
p
,
q
,
r
,
w
,
s
,
c
,
df
;
int
hx
,
ix
;
int
hx
,
ix
;
hx
=
__HI
(
x
);
union
{
int
i
[
2
];
double
d
;
}
ux
;
ux
.
d
=
x
;
hx
=
ux
.
i
[
HIWORD
];
ix
=
hx
&
0x7fffffff
;
ix
=
hx
&
0x7fffffff
;
if
(
ix
>=
0x3ff00000
)
{
/* |x| >= 1 */
if
(
ix
>=
0x3ff00000
)
{
/* |x| >= 1 */
if
(((
ix
-
0x3ff00000
)
|
__LO
(
x
)
)
==
0
)
{
/* |x|==1 */
if
(((
ix
-
0x3ff00000
)
|
ux
.
i
[
LOWORD
]
)
==
0
)
{
/* |x|==1 */
if
(
hx
>
0
)
return
0
.
0
;
/* acos(1) = 0 */
if
(
hx
>
0
)
return
0
.
0
;
/* acos(1) = 0 */
else
return
pi
+
2
.
0
*
pio2_lo
;
/* acos(-1)= pi */
else
return
pi
+
2
.
0
*
pio2_lo
;
/* acos(-1)= pi */
}
}
...
@@ -94,7 +97,9 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
...
@@ -94,7 +97,9 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
z
=
(
one
-
x
)
*
0
.
5
;
z
=
(
one
-
x
)
*
0
.
5
;
s
=
sqrt
(
z
);
s
=
sqrt
(
z
);
df
=
s
;
df
=
s
;
__LO
(
df
)
=
0
;
ux
.
d
=
df
;
ux
.
i
[
LOWORD
]
=
0
;
df
=
ux
.
d
;
c
=
(
z
-
df
*
df
)
/
(
s
+
df
);
c
=
(
z
-
df
*
df
)
/
(
s
+
df
);
p
=
z
*
(
pS0
+
z
*
(
pS1
+
z
*
(
pS2
+
z
*
(
pS3
+
z
*
(
pS4
+
z
*
pS5
)))));
p
=
z
*
(
pS0
+
z
*
(
pS1
+
z
*
(
pS2
+
z
*
(
pS3
+
z
*
(
pS4
+
z
*
pS5
)))));
q
=
one
+
z
*
(
qS1
+
z
*
(
qS2
+
z
*
(
qS3
+
z
*
qS4
)));
q
=
one
+
z
*
(
qS1
+
z
*
(
qS2
+
z
*
(
qS3
+
z
*
qS4
)));
...
...
This diff is collapsed.
Click to expand it.
src/lisp/e_asin.c
+
8
−
3
View file @
9adcb02d
...
@@ -75,10 +75,13 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
...
@@ -75,10 +75,13 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
{
{
double
t
,
w
,
p
,
q
,
c
,
r
,
s
;
double
t
,
w
,
p
,
q
,
c
,
r
,
s
;
int
hx
,
ix
;
int
hx
,
ix
;
hx
=
__HI
(
x
);
union
{
int
i
[
2
];
double
d
;
}
ux
;
ux
.
d
=
x
;
hx
=
ux
.
i
[
HIWORD
];
ix
=
hx
&
0x7fffffff
;
ix
=
hx
&
0x7fffffff
;
if
(
ix
>=
0x3ff00000
)
{
/* |x|>= 1 */
if
(
ix
>=
0x3ff00000
)
{
/* |x|>= 1 */
if
(((
ix
-
0x3ff00000
)
|
__LO
(
x
)
)
==
0
)
if
(((
ix
-
0x3ff00000
)
|
ux
.
i
[
LOWORD
]
)
==
0
)
/* asin(1)=+-pi/2 with inexact */
/* asin(1)=+-pi/2 with inexact */
return
x
*
pio2_hi
+
x
*
pio2_lo
;
return
x
*
pio2_hi
+
x
*
pio2_lo
;
return
(
x
-
x
)
/
(
x
-
x
);
/* asin(|x|>1) is NaN */
return
(
x
-
x
)
/
(
x
-
x
);
/* asin(|x|>1) is NaN */
...
@@ -103,7 +106,9 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
...
@@ -103,7 +106,9 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
t
=
pio2_hi
-
(
2
.
0
*
(
s
+
s
*
w
)
-
pio2_lo
);
t
=
pio2_hi
-
(
2
.
0
*
(
s
+
s
*
w
)
-
pio2_lo
);
}
else
{
}
else
{
w
=
s
;
w
=
s
;
__LO
(
w
)
=
0
;
ux
.
d
=
w
;
ux
.
i
[
LOWORD
]
=
0
;
w
=
ux
.
d
;
c
=
(
t
-
w
*
w
)
/
(
s
+
w
);
c
=
(
t
-
w
*
w
)
/
(
s
+
w
);
r
=
p
/
q
;
r
=
p
/
q
;
p
=
2
.
0
*
s
*
r
-
(
pio2_lo
-
2
.
0
*
c
);
p
=
2
.
0
*
s
*
r
-
(
pio2_lo
-
2
.
0
*
c
);
...
...
This diff is collapsed.
Click to expand it.
src/lisp/s_atan.c
+
6
−
4
View file @
9adcb02d
...
@@ -83,20 +83,22 @@ one = 1.0,
...
@@ -83,20 +83,22 @@ one = 1.0,
huge
=
1.0e300
;
huge
=
1.0e300
;
#ifdef __STDC__
#ifdef __STDC__
double
atan
(
double
x
)
double
fdlibm_
atan
(
double
x
)
#else
#else
double
atan
(
x
)
double
fdlibm_
atan
(
x
)
double
x
;
double
x
;
#endif
#endif
{
{
double
w
,
s1
,
s2
,
z
;
double
w
,
s1
,
s2
,
z
;
int
ix
,
hx
,
id
;
int
ix
,
hx
,
id
;
union
{
int
i
[
2
];
double
d
;
}
ux
;
hx
=
__HI
(
x
);
ux
.
d
=
x
;
hx
=
ux
.
i
[
HIWORD
];
ix
=
hx
&
0x7fffffff
;
ix
=
hx
&
0x7fffffff
;
if
(
ix
>=
0x44100000
)
{
/* if |x| >= 2^66 */
if
(
ix
>=
0x44100000
)
{
/* if |x| >= 2^66 */
if
(
ix
>
0x7ff00000
||
if
(
ix
>
0x7ff00000
||
(
ix
==
0x7ff00000
&&
(
__LO
(
x
)
!=
0
)))
(
ix
==
0x7ff00000
&&
(
ux
.
i
[
LOWORD
]
!=
0
)))
return
x
+
x
;
/* NaN */
return
x
+
x
;
/* NaN */
if
(
hx
>
0
)
return
atanhi
[
3
]
+
atanlo
[
3
];
if
(
hx
>
0
)
return
atanhi
[
3
]
+
atanlo
[
3
];
else
return
-
atanhi
[
3
]
-
atanlo
[
3
];
else
return
-
atanhi
[
3
]
-
atanlo
[
3
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment