Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
bb9f97c4
Commit
bb9f97c4
authored
May 29, 2021
by
Piotr Caban
Committed by
Alexandre Julliard
May 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Import tanhf implementation from musl.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3171dccb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
13 deletions
+37
-13
math.c
dlls/msvcrt/math.c
+37
-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 @
bb9f97c4
...
...
@@ -1512,9 +1512,43 @@ float CDECL tanf( float x )
*/
float
CDECL
tanhf
(
float
x
)
{
float
ret
=
unix_funcs
->
tanhf
(
x
);
if
(
!
isfinite
(
x
))
return
math_error
(
_DOMAIN
,
"tanhf"
,
x
,
0
,
ret
);
return
ret
;
UINT32
ui
=
*
(
UINT32
*
)
&
x
;
int
sign
;
float
t
;
/* x = |x| */
sign
=
ui
>>
31
;
ui
&=
0x7fffffff
;
x
=
*
(
float
*
)
&
ui
;
if
(
ui
>
0x3f0c9f54
)
{
/* |x| > log(3)/2 ~= 0.5493 or nan */
if
(
ui
>
0x41200000
)
{
#if _MSVCR_VER < 140
if
(
isnan
(
x
))
return
math_error
(
_DOMAIN
,
"tanhf"
,
x
,
0
,
x
);
#endif
/* |x| > 10 */
fp_barrierf
(
x
+
0x1
p120f
);
t
=
1
+
0
/
x
;
}
else
{
t
=
__expm1f
(
2
*
x
);
t
=
1
-
2
/
(
t
+
2
);
}
}
else
if
(
ui
>
0x3e82c578
)
{
/* |x| > log(5/3)/2 ~= 0.2554 */
t
=
__expm1f
(
2
*
x
);
t
=
t
/
(
t
+
2
);
}
else
if
(
ui
>=
0x00800000
)
{
/* |x| >= 0x1p-126 */
t
=
__expm1f
(
-
2
*
x
);
t
=
-
t
/
(
t
+
2
);
}
else
{
/* |x| is subnormal */
fp_barrierf
(
x
*
x
);
t
=
x
;
}
return
sign
?
-
t
:
t
;
}
/*********************************************************************
...
...
dlls/msvcrt/unixlib.c
View file @
bb9f97c4
...
...
@@ -269,14 +269,6 @@ static float CDECL unix_powf( float x, float y )
}
/*********************************************************************
* tanhf
*/
static
float
CDECL
unix_tanhf
(
float
x
)
{
return
tanhf
(
x
);
}
/*********************************************************************
* tgamma
*/
static
double
CDECL
unix_tgamma
(
double
x
)
...
...
@@ -327,7 +319,6 @@ static const struct unix_funcs funcs =
unix_log2f
,
unix_pow
,
unix_powf
,
unix_tanhf
,
unix_tgamma
,
unix_tgammaf
,
};
...
...
dlls/msvcrt/unixlib.h
View file @
bb9f97c4
...
...
@@ -46,7 +46,6 @@ struct unix_funcs
float
(
CDECL
*
log2f
)(
float
x
);
double
(
CDECL
*
pow
)(
double
x
,
double
y
);
float
(
CDECL
*
powf
)(
float
x
,
float
y
);
float
(
CDECL
*
tanhf
)(
float
x
);
double
(
CDECL
*
tgamma
)(
double
x
);
float
(
CDECL
*
tgammaf
)(
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