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
b22ffa58
Commit
b22ffa58
authored
Jul 23, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Don't depend on additional mantissa bits when rounding.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8fc48e8b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
string.c
dlls/msvcrt/string.c
+11
-6
No files found.
dlls/msvcrt/string.c
View file @
b22ffa58
...
...
@@ -831,12 +831,17 @@ struct fpnum fpnum_parse(MSVCRT_wchar_t (*get)(void *ctx), void (*unget)(void *c
e2
++
;
}
/* Check if fractional part is non-zero */
/* Caution: it's only correct because bnum_to_mant returns more than 53 bits */
for
(
i
=
b
->
e
-
4
;
i
>=
b
->
b
;
i
--
)
{
if
(
!
b
->
data
[
bnum_idx
(
b
,
b
->
b
)])
continue
;
round
=
FP_ROUND_DOWN
;
break
;
if
(
b
->
e
-
4
>=
b
->
b
&&
b
->
data
[
bnum_idx
(
b
,
b
->
e
-
4
)])
{
if
(
b
->
data
[
bnum_idx
(
b
,
b
->
e
-
4
)]
>
LIMB_MAX
/
2
)
round
=
FP_ROUND_UP
;
else
if
(
b
->
data
[
bnum_idx
(
b
,
b
->
e
-
4
)]
==
LIMB_MAX
/
2
)
round
=
FP_ROUND_EVEN
;
else
round
=
FP_ROUND_DOWN
;
}
if
(
round
==
FP_ROUND_ZERO
||
round
==
FP_ROUND_EVEN
)
{
for
(
i
=
b
->
e
-
5
;
i
>=
b
->
b
;
i
--
)
{
if
(
!
b
->
data
[
bnum_idx
(
b
,
b
->
b
)])
continue
;
if
(
round
==
FP_ROUND_EVEN
)
round
=
FP_ROUND_UP
;
else
round
=
FP_ROUND_DOWN
;
}
}
return
fpnum
(
sign
,
e2
,
m
,
round
);
...
...
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