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
73c0d36a
Commit
73c0d36a
authored
May 23, 2021
by
Piotr Caban
Committed by
Alexandre Julliard
May 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Import tan implementation from musl.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
88dc2d0e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
13 deletions
+84
-13
math.c
dlls/msvcrt/math.c
+84
-3
unixlib.c
dlls/msvcrt/unixlib.c
+0
-9
unixlib.h
dlls/msvcrt/unixlib.h
+0
-1
No files found.
dlls/msvcrt/math.c
View file @
73c0d36a
...
...
@@ -2179,14 +2179,95 @@ double CDECL sqrt( double x )
#endif
}
/* Copied from musl: src/math/__tan.c */
static
double
__tan
(
double
x
,
double
y
,
int
odd
)
{
static
const
double
T
[]
=
{
3.33333333333334091986e-01
,
1.33333333333201242699e-01
,
5.39682539762260521377e-02
,
2.18694882948595424599e-02
,
8.86323982359930005737e-03
,
3.59207910759131235356e-03
,
1.45620945432529025516e-03
,
5.88041240820264096874e-04
,
2.46463134818469906812e-04
,
7.81794442939557092300e-05
,
7.14072491382608190305e-05
,
-
1.85586374855275456654e-05
,
2.59073051863633712884e-05
,
};
static
const
double
pio4
=
7.85398163397448278999e-01
;
static
const
double
pio4lo
=
3.06161699786838301793e-17
;
double
z
,
r
,
v
,
w
,
s
,
a
,
w0
,
a0
;
UINT32
hx
;
int
big
,
sign
;
hx
=
*
(
ULONGLONG
*
)
&
x
>>
32
;
big
=
(
hx
&
0x7fffffff
)
>=
0x3FE59428
;
/* |x| >= 0.6744 */
if
(
big
)
{
sign
=
hx
>>
31
;
if
(
sign
)
{
x
=
-
x
;
y
=
-
y
;
}
x
=
(
pio4
-
x
)
+
(
pio4lo
-
y
);
y
=
0
.
0
;
}
z
=
x
*
x
;
w
=
z
*
z
;
r
=
T
[
1
]
+
w
*
(
T
[
3
]
+
w
*
(
T
[
5
]
+
w
*
(
T
[
7
]
+
w
*
(
T
[
9
]
+
w
*
T
[
11
]))));
v
=
z
*
(
T
[
2
]
+
w
*
(
T
[
4
]
+
w
*
(
T
[
6
]
+
w
*
(
T
[
8
]
+
w
*
(
T
[
10
]
+
w
*
T
[
12
])))));
s
=
z
*
x
;
r
=
y
+
z
*
(
s
*
(
r
+
v
)
+
y
)
+
s
*
T
[
0
];
w
=
x
+
r
;
if
(
big
)
{
s
=
1
-
2
*
odd
;
v
=
s
-
2
.
0
*
(
x
+
(
r
-
w
*
w
/
(
w
+
s
)));
return
sign
?
-
v
:
v
;
}
if
(
!
odd
)
return
w
;
/* -1.0/(x+r) has up to 2ulp error, so compute it accurately */
w0
=
w
;
*
(
LONGLONG
*
)
&
w0
=
*
(
LONGLONG
*
)
&
w0
&
0xffffffff00000000ULL
;
v
=
r
-
(
w0
-
x
);
/* w0+v = r+x */
a0
=
a
=
-
1
.
0
/
w
;
*
(
LONGLONG
*
)
&
a0
=
*
(
LONGLONG
*
)
&
a0
&
0xffffffff00000000ULL
;
return
a0
+
a
*
(
1
.
0
+
a0
*
w0
+
a0
*
v
);
}
/*********************************************************************
* tan (MSVCRT.@)
*
* Copied from musl: src/math/tan.c
*/
double
CDECL
tan
(
double
x
)
{
double
ret
=
unix_funcs
->
tan
(
x
);
if
(
!
isfinite
(
x
))
return
math_error
(
_DOMAIN
,
"tan"
,
x
,
0
,
ret
);
return
ret
;
double
y
[
2
];
UINT32
ix
;
unsigned
n
;
ix
=
*
(
ULONGLONG
*
)
&
x
>>
32
;
ix
&=
0x7fffffff
;
if
(
ix
<=
0x3fe921fb
)
{
/* |x| ~< pi/4 */
if
(
ix
<
0x3e400000
)
{
/* |x| < 2**-27 */
/* raise inexact if x!=0 and underflow if subnormal */
fp_barrier
(
ix
<
0x00100000
?
x
/
0x1
p120f
:
x
+
0x1
p120f
);
return
x
;
}
return
__tan
(
x
,
0
.
0
,
0
);
}
if
(
isinf
(
x
))
return
math_error
(
_DOMAIN
,
"tan"
,
x
,
0
,
x
-
x
);
if
(
ix
>=
0x7ff00000
)
return
x
-
x
;
n
=
__rem_pio2
(
x
,
y
);
return
__tan
(
y
[
0
],
y
[
1
],
n
&
1
);
}
/*********************************************************************
...
...
dlls/msvcrt/unixlib.c
View file @
73c0d36a
...
...
@@ -420,14 +420,6 @@ static float CDECL unix_sinhf( float x )
}
/*********************************************************************
* tan
*/
static
double
CDECL
unix_tan
(
double
x
)
{
return
tan
(
x
);
}
/*********************************************************************
* tanf
*/
static
float
CDECL
unix_tanf
(
float
x
)
...
...
@@ -516,7 +508,6 @@ static const struct unix_funcs funcs =
unix_sinf
,
unix_sinh
,
unix_sinhf
,
unix_tan
,
unix_tanf
,
unix_tanh
,
unix_tanhf
,
...
...
dlls/msvcrt/unixlib.h
View file @
73c0d36a
...
...
@@ -60,7 +60,6 @@ struct unix_funcs
float
(
CDECL
*
sinf
)(
float
x
);
double
(
CDECL
*
sinh
)(
double
x
);
float
(
CDECL
*
sinhf
)(
float
x
);
double
(
CDECL
*
tan
)(
double
x
);
float
(
CDECL
*
tanf
)(
float
x
);
double
(
CDECL
*
tanh
)(
double
x
);
float
(
CDECL
*
tanhf
)(
float
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