Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2cb6a178
Commit
2cb6a178
authored
Aug 06, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Aug 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Import asin from musl.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d37e76a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
4 deletions
+66
-4
math.c
dlls/msvcrt/math.c
+66
-4
No files found.
dlls/msvcrt/math.c
View file @
2cb6a178
...
...
@@ -654,13 +654,75 @@ double CDECL MSVCRT_acos( double x )
/*********************************************************************
* MSVCRT_asin (MSVCRT.@)
*
* Copied from musl: src/math/asin.c
*/
static
double
asin_R
(
double
z
)
{
/* coefficients for R(x^2) */
static
const
double
pS0
=
1.66666666666666657415e-01
,
pS1
=
-
3.25565818622400915405e-01
,
pS2
=
2.01212532134862925881e-01
,
pS3
=
-
4.00555345006794114027e-02
,
pS4
=
7.91534994289814532176e-04
,
pS5
=
3.47933107596021167570e-05
,
qS1
=
-
2.40339491173441421878e+00
,
qS2
=
2.02094576023350569471e+00
,
qS3
=
-
6.88283971605453293030e-01
,
qS4
=
7.70381505559019352791e-02
;
double
p
,
q
;
p
=
z
*
(
pS0
+
z
*
(
pS1
+
z
*
(
pS2
+
z
*
(
pS3
+
z
*
(
pS4
+
z
*
pS5
)))));
q
=
1
.
0
+
z
*
(
qS1
+
z
*
(
qS2
+
z
*
(
qS3
+
z
*
qS4
)));
return
p
/
q
;
}
double
CDECL
MSVCRT_asin
(
double
x
)
{
double
ret
=
atan2
(
x
,
sqrt
((
1
-
x
)
*
(
1
+
x
)));
if
(
x
<
-
1
.
0
||
x
>
1
.
0
||
!
isfinite
(
x
))
return
math_error
(
_DOMAIN
,
"asin"
,
x
,
0
,
ret
);
return
ret
;
static
const
double
pio2_hi
=
1.57079632679489655800e+00
,
pio2_lo
=
6.12323399573676603587e-17
;
double
z
,
r
,
s
;
unsigned
int
hx
,
ix
;
ULONGLONG
llx
;
hx
=
*
(
ULONGLONG
*
)
&
x
>>
32
;
ix
=
hx
&
0x7fffffff
;
/* |x| >= 1 or nan */
if
(
ix
>=
0x3ff00000
)
{
unsigned
int
lx
;
lx
=
*
(
ULONGLONG
*
)
&
x
;
if
(((
ix
-
0x3ff00000
)
|
lx
)
==
0
)
/* asin(1) = +-pi/2 with inexact */
return
x
*
pio2_hi
+
7.5231638452626401e-37
;
if
(
isnan
(
x
))
return
x
;
return
math_error
(
_DOMAIN
,
"asin"
,
x
,
0
,
0
/
(
x
-
x
));
}
/* |x| < 0.5 */
if
(
ix
<
0x3fe00000
)
{
/* if 0x1p-1022 <= |x| < 0x1p-26, avoid raising underflow */
if
(
ix
<
0x3e500000
&&
ix
>=
0x00100000
)
return
x
;
return
x
+
x
*
asin_R
(
x
*
x
);
}
/* 1 > |x| >= 0.5 */
z
=
(
1
-
fabs
(
x
))
*
0
.
5
;
s
=
sqrt
(
z
);
r
=
asin_R
(
z
);
if
(
ix
>=
0x3fef3333
)
{
/* if |x| > 0.975 */
x
=
pio2_hi
-
(
2
*
(
s
+
s
*
r
)
-
pio2_lo
);
}
else
{
double
f
,
c
;
/* f+c = sqrt(z) */
f
=
s
;
llx
=
(
*
(
ULONGLONG
*
)
&
f
>>
32
)
<<
32
;
f
=
*
(
double
*
)
&
llx
;
c
=
(
z
-
f
*
f
)
/
(
s
+
f
);
x
=
0
.
5
*
pio2_hi
-
(
2
*
s
*
r
-
(
pio2_lo
-
2
*
c
)
-
(
0
.
5
*
pio2_hi
-
2
*
f
));
}
if
(
hx
>>
31
)
return
-
x
;
return
x
;
}
/*********************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment