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
ef91a7c0
Commit
ef91a7c0
authored
May 20, 2021
by
Piotr Caban
Committed by
Alexandre Julliard
May 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Import cos implementation from musl.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ceefbb76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
3 deletions
+32
-3
math.c
dlls/msvcrt/math.c
+32
-3
No files found.
dlls/msvcrt/math.c
View file @
ef91a7c0
...
...
@@ -1802,12 +1802,41 @@ static double __cos(double x, double y)
/*********************************************************************
* cos (MSVCRT.@)
*
* Copied from musl: src/math/cos.c
*/
double
CDECL
cos
(
double
x
)
{
double
ret
=
unix_funcs
->
cos
(
x
);
if
(
!
isfinite
(
x
))
return
math_error
(
_DOMAIN
,
"cos"
,
x
,
0
,
ret
);
return
ret
;
double
y
[
2
];
UINT32
ix
;
unsigned
n
;
ix
=
*
(
ULONGLONG
*
)
&
x
>>
32
;
ix
&=
0x7fffffff
;
/* |x| ~< pi/4 */
if
(
ix
<=
0x3fe921fb
)
{
if
(
ix
<
0x3e46a09e
)
{
/* |x| < 2**-27 * sqrt(2) */
/* raise inexact if x!=0 */
fp_barrier
(
x
+
0x1
p120f
);
return
1
.
0
;
}
return
__cos
(
x
,
0
);
}
/* cos(Inf or NaN) is NaN */
if
(
isinf
(
x
))
return
math_error
(
_DOMAIN
,
"cos"
,
x
,
0
,
x
-
x
);
if
(
ix
>=
0x7ff00000
)
return
x
-
x
;
/* argument reduction */
n
=
__rem_pio2
(
x
,
y
);
switch
(
n
&
3
)
{
case
0
:
return
__cos
(
y
[
0
],
y
[
1
]);
case
1
:
return
-
__sin
(
y
[
0
],
y
[
1
],
1
);
case
2
:
return
-
__cos
(
y
[
0
],
y
[
1
]);
default
:
return
__sin
(
y
[
0
],
y
[
1
],
1
);
}
}
/*********************************************************************
...
...
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