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
8a8d1ded
Commit
8a8d1ded
authored
Feb 24, 2024
by
Sven Baars
Committed by
Alexandre Julliard
Feb 26, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Use scientific notation if it prevents a loss of accuracy.
parent
1b32ac45
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
vartype.c
dlls/oleaut32/tests/vartype.c
+16
-6
vartype.c
dlls/oleaut32/vartype.c
+9
-1
No files found.
dlls/oleaut32/tests/vartype.c
View file @
8a8d1ded
...
...
@@ -4679,12 +4679,22 @@ static void test_VarBstrFromR8(void)
{
static
const
struct
r8_test
tests_en
[]
=
{
{
0
.
5
,
L"0.5"
},
{
0
.
05
,
L"0.05"
},
{
0
.
005
,
L"0.005"
},
{
0
.
0005
,
L"0.0005"
},
{
0
.
00005
,
L"0.00005"
},
{
0
.
000005
,
L"0.000005"
},
{
0
.
56789
,
L"0.56789"
},
{
5.6789e-2
,
L"0.056789"
},
{
5.6789e-3
,
L"0.0056789"
},
{
5.6789e-4
,
L"0.00056789"
},
{
5.6789e-5
,
L"0.000056789"
},
{
5.6789e-6
,
L"0.0000056789"
},
{
5.6789e-7
,
L"0.00000056789"
},
{
5.6789e-8
,
L"0.000000056789"
},
{
5.6789e-9
,
L"0.0000000056789"
},
{
5.6789e-10
,
L"0.00000000056789"
},
{
5.6789e-11
,
L"0.000000000056789"
},
{
5.6789e-12
,
L"5.6789E-12"
},
{
5.6789e-13
,
L"5.6789E-13"
},
{
5.6789e-14
,
L"5.6789E-14"
},
{
5.6789e-15
,
L"5.6789E-15"
},
{
5.6789e-16
,
L"5.6789E-16"
},
{
1.0e8
,
L"100000000"
},
{
1.0e12
,
L"1000000000000"
},
...
...
dlls/oleaut32/vartype.c
View file @
8a8d1ded
...
...
@@ -6550,11 +6550,19 @@ static HRESULT VARIANT_BstrFromReal(DOUBLE dblIn, LCID lcid, ULONG dwFlags,
if
(
!
(
locale
=
_create_locale
(
LC_ALL
,
"C"
)))
return
E_OUTOFMEMORY
;
len
=
_swprintf_l
(
buff
,
ARRAY_SIZE
(
buff
),
L"%.*G"
,
locale
,
ndigits
,
dblIn
);
e
=
wcschr
(
buff
,
'E'
);
if
(
e
&&
labs
(
wcstol
(
e
+
1
,
NULL
,
10
))
<
ndigits
)
if
(
e
)
{
int
extra_decimals
;
WCHAR
*
dot
;
dot
=
wcschr
(
buff
,
'.'
);
extra_decimals
=
dot
?
e
-
dot
-
2
:
0
;
if
(
labs
(
wcstol
(
e
+
1
,
NULL
,
10
))
+
extra_decimals
<
ndigits
)
{
len
=
_swprintf_l
(
buff
,
ARRAY_SIZE
(
buff
),
L"%.*f"
,
locale
,
ndigits
,
dblIn
);
while
(
len
>
0
&&
(
buff
[
len
-
1
]
==
'0'
))
len
--
;
}
}
buff
[
len
]
=
0
;
_free_locale
(
locale
);
...
...
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