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
77acdcc0
Commit
77acdcc0
authored
Feb 21, 2010
by
André Hentschel
Committed by
Alexandre Julliard
Feb 22, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Fix rounding.
parent
bc07b48b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
varformat.c
dlls/oleaut32/tests/varformat.c
+8
-2
varformat.c
dlls/oleaut32/varformat.c
+10
-1
No files found.
dlls/oleaut32/tests/varformat.c
View file @
77acdcc0
...
...
@@ -381,8 +381,14 @@ static void test_VarFormat(void)
VARFMT
(
VT_R8
,
V_R8
,
-
0
.
1
,
".#"
,
S_OK
,
"-.1"
);
VARFMT
(
VT_R8
,
V_R8
,
0
.
099
,
"#.#"
,
S_OK
,
".1"
);
VARFMT
(
VT_R8
,
V_R8
,
0
.
0999
,
"#.##"
,
S_OK
,
".1"
);
/* for large negative exponents, wine truncates instead of rounding */
todo_wine
VARFMT
(
VT_R8
,
V_R8
,
0
.
099
,
"#.##"
,
S_OK
,
".1"
);
VARFMT
(
VT_R8
,
V_R8
,
0
.
099
,
"#.##"
,
S_OK
,
".1"
);
VARFMT
(
VT_R8
,
V_R8
,
0
.
00
99
,
"#.##"
,
S_OK
,
".01"
);
VARFMT
(
VT_R8
,
V_R8
,
0
.
004
9
,
"#.##"
,
S_OK
,
"."
);
VARFMT
(
VT_R8
,
V_R8
,
0
.
00
94
,
"#.##"
,
S_OK
,
".01"
);
VARFMT
(
VT_R8
,
V_R8
,
0
.
000
99
,
"#.##"
,
S_OK
,
"."
);
VARFMT
(
VT_R8
,
V_R8
,
0
.
0995
,
"#.##"
,
S_OK
,
".1"
);
VARFMT
(
VT_R8
,
V_R8
,
8
.
0995
,
"#.##"
,
S_OK
,
"8.1"
);
VARFMT
(
VT_R8
,
V_R8
,
0
.
0994
,
"#.##"
,
S_OK
,
".1"
);
/* 'out' is not cleared */
...
...
dlls/oleaut32/varformat.c
View file @
77acdcc0
...
...
@@ -1285,12 +1285,21 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
have_frac
=
-
pad
;
pad
=
0
;
}
if
(
exponent
<
0
&&
exponent
>
(
-
256
+
have_int
+
have_frac
))
{
/* Remove exponent notation */
memmove
(
rgbDig
-
exponent
,
rgbDig
,
have_int
+
have_frac
);
ZeroMemory
(
rgbDig
,
-
exponent
);
have_frac
-=
exponent
;
exponent
=
0
;
}
}
/* Rounding the number */
if
(
have_frac
>
need_frac
)
{
prgbDig
=
&
rgbDig
[
have_int
+
need_frac
];
prgbDig
=
&
rgbDig
[
have_int
+
need_frac
?
need_frac
+
1
:
0
];
if
(
*
prgbDig
<
5
)
prgbDig
--
;
have_frac
=
need_frac
;
if
(
*
prgbDig
>=
5
)
{
...
...
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