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
29288c0b
Commit
29288c0b
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: Fix rounding of numbers smaller than minimal subnormal.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4fe481db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
string.c
dlls/msvcrt/string.c
+15
-13
string.c
dlls/ucrtbase/tests/string.c
+2
-0
No files found.
dlls/msvcrt/string.c
View file @
29288c0b
...
...
@@ -413,25 +413,21 @@ int fpnum_double(struct fpnum *fp, double *d)
fp
->
m
>>=
1
;
fp
->
exp
++
;
}
/* handle subnormal that falls into regular range due to rounding */
fp
->
exp
+=
(
1
<<
(
EXP_BITS
-
1
))
-
1
;
if
(
!
fp
->
exp
&&
(
fp
->
mod
==
FP_ROUND_UP
||
(
fp
->
mod
==
FP_ROUND_EVEN
&&
fp
->
m
&
1
)))
{
if
(
fp
->
m
+
1
>=
(
ULONGLONG
)
1
<<
MANT_BITS
)
{
fp
->
m
++
;
fp
->
m
>>=
1
;
fp
->
exp
++
;
fp
->
mod
=
FP_ROUND_DOWN
;
}
}
/* handle subnormals */
if
(
fp
->
exp
<=
0
)
{
if
(
fp
->
m
&
1
&&
fp
->
mod
==
FP_ROUND_ZERO
)
fp
->
mod
=
FP_ROUND_EVEN
;
else
if
(
fp
->
m
&
1
)
fp
->
mod
=
FP_ROUND_UP
;
else
if
(
fp
->
mod
!=
FP_ROUND_ZERO
)
fp
->
mod
=
FP_ROUND_DOWN
;
fp
->
m
>>=
1
;
}
while
(
fp
->
m
&&
fp
->
exp
<
0
)
{
if
(
fp
->
m
&
1
&&
fp
->
mod
==
FP_ROUND_ZERO
)
fp
->
mod
=
FP_ROUND_EVEN
;
else
if
(
fp
->
m
&
1
)
fp
->
mod
=
FP_ROUND_UP
;
else
if
(
fp
->
mod
!=
FP_ROUND_ZERO
)
fp
->
mod
=
FP_ROUND_DOWN
;
fp
->
m
>>=
1
;
fp
->
exp
++
;
}
...
...
@@ -440,7 +436,13 @@ int fpnum_double(struct fpnum *fp, double *d)
if
(
fp
->
mod
==
FP_ROUND_UP
||
(
fp
->
mod
==
FP_ROUND_EVEN
&&
fp
->
m
&
1
))
{
fp
->
m
++
;
if
(
fp
->
m
>=
(
ULONGLONG
)
1
<<
MANT_BITS
)
/* handle subnormal that falls into regular range due to rounding */
if
(
fp
->
m
==
(
ULONGLONG
)
1
<<
(
MANT_BITS
-
1
))
{
fp
->
exp
++
;
}
else
if
(
fp
->
m
>=
(
ULONGLONG
)
1
<<
MANT_BITS
)
{
fp
->
exp
++
;
fp
->
m
>>=
1
;
...
...
dlls/ucrtbase/tests/string.c
View file @
29288c0b
...
...
@@ -148,6 +148,8 @@ static void test_strtod(void)
test_strtod_str
(
"1.7976931348623158e+308"
,
1.7976931348623158e+308
,
23
);
test_strtod_str
(
"2.2250738585072014e-308"
,
2.2250738585072014e-308
,
23
);
test_strtod_str
(
"4.9406564584124654e-324"
,
4.9406564584124654e-324
,
23
);
test_strtod_str
(
"2.48e-324"
,
4.9406564584124654e-324
,
9
);
test_strtod_str_errno
(
"2.47e-324"
,
0
,
9
,
ERANGE
);
}
static
void
test__memicmp
(
void
)
...
...
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