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
5e34d175
Commit
5e34d175
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 tanf implementation from musl.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
14a8e16a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
13 deletions
+69
-13
math.c
dlls/msvcrt/math.c
+69
-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 @
5e34d175
...
...
@@ -1285,14 +1285,80 @@ float CDECL sqrtf( float x )
#endif
}
/* Copied from musl: src/math/__tandf.c */
static
float
__tandf
(
double
x
,
int
odd
)
{
static
const
double
T
[]
=
{
0x15554d3418c99f
.
0
p
-
54
,
0x1112fd38999f72
.
0
p
-
55
,
0x1b54c91d865afe
.
0
p
-
57
,
0x191df3908c33ce
.
0
p
-
58
,
0x185dadfcecf44e
.
0
p
-
61
,
0x1362b9bf971bcd
.
0
p
-
59
,
};
double
z
,
r
,
w
,
s
,
t
,
u
;
z
=
x
*
x
;
r
=
T
[
4
]
+
z
*
T
[
5
];
t
=
T
[
2
]
+
z
*
T
[
3
];
w
=
z
*
z
;
s
=
z
*
x
;
u
=
T
[
0
]
+
z
*
T
[
1
];
r
=
(
x
+
s
*
u
)
+
(
s
*
w
)
*
(
t
+
w
*
r
);
return
odd
?
-
1
.
0
/
r
:
r
;
}
/*********************************************************************
* tanf (MSVCRT.@)
*
* Copied from musl: src/math/tanf.c
*/
float
CDECL
tanf
(
float
x
)
{
float
ret
=
unix_funcs
->
tanf
(
x
);
if
(
!
isfinite
(
x
))
return
math_error
(
_DOMAIN
,
"tanf"
,
x
,
0
,
ret
);
return
ret
;
static
const
double
t1pio2
=
1
*
M_PI_2
,
t2pio2
=
2
*
M_PI_2
,
t3pio2
=
3
*
M_PI_2
,
t4pio2
=
4
*
M_PI_2
;
double
y
;
UINT32
ix
;
unsigned
n
,
sign
;
ix
=
*
(
UINT32
*
)
&
x
;
sign
=
ix
>>
31
;
ix
&=
0x7fffffff
;
if
(
ix
<=
0x3f490fda
)
{
/* |x| ~<= pi/4 */
if
(
ix
<
0x39800000
)
{
/* |x| < 2**-12 */
/* raise inexact if x!=0 and underflow if subnormal */
fp_barrierf
(
ix
<
0x00800000
?
x
/
0x1
p120f
:
x
+
0x1
p120f
);
return
x
;
}
return
__tandf
(
x
,
0
);
}
if
(
ix
<=
0x407b53d1
)
{
/* |x| ~<= 5*pi/4 */
if
(
ix
<=
0x4016cbe3
)
/* |x| ~<= 3pi/4 */
return
__tandf
((
sign
?
x
+
t1pio2
:
x
-
t1pio2
),
1
);
else
return
__tandf
((
sign
?
x
+
t2pio2
:
x
-
t2pio2
),
0
);
}
if
(
ix
<=
0x40e231d5
)
{
/* |x| ~<= 9*pi/4 */
if
(
ix
<=
0x40afeddf
)
/* |x| ~<= 7*pi/4 */
return
__tandf
((
sign
?
x
+
t3pio2
:
x
-
t3pio2
),
1
);
else
return
__tandf
((
sign
?
x
+
t4pio2
:
x
-
t4pio2
),
0
);
}
/* tan(Inf or NaN) is NaN */
if
(
isinf
(
x
))
return
math_error
(
_DOMAIN
,
"tanf"
,
x
,
0
,
x
-
x
);
if
(
ix
>=
0x7f800000
)
return
x
-
x
;
/* argument reduction */
n
=
__rem_pio2f
(
x
,
&
y
);
return
__tandf
(
y
,
n
&
1
);
}
/*********************************************************************
...
...
dlls/msvcrt/unixlib.c
View file @
5e34d175
...
...
@@ -404,14 +404,6 @@ static float CDECL unix_sinhf( float x )
}
/*********************************************************************
* tanf
*/
static
float
CDECL
unix_tanf
(
float
x
)
{
return
tanf
(
x
);
}
/*********************************************************************
* tanh
*/
static
double
CDECL
unix_tanh
(
double
x
)
...
...
@@ -490,7 +482,6 @@ static const struct unix_funcs funcs =
unix_powf
,
unix_sinh
,
unix_sinhf
,
unix_tanf
,
unix_tanh
,
unix_tanhf
,
unix_tgamma
,
...
...
dlls/msvcrt/unixlib.h
View file @
5e34d175
...
...
@@ -58,7 +58,6 @@ struct unix_funcs
float
(
CDECL
*
powf
)(
float
x
,
float
y
);
double
(
CDECL
*
sinh
)(
double
x
);
float
(
CDECL
*
sinhf
)(
float
x
);
float
(
CDECL
*
tanf
)(
float
x
);
double
(
CDECL
*
tanh
)(
double
x
);
float
(
CDECL
*
tanhf
)(
float
x
);
double
(
CDECL
*
tgamma
)(
double
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