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
48a86230
Commit
48a86230
authored
May 16, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
May 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Round half to even in to_int.
Spotted by Zhan Jianyu.
parent
75595264
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
global.c
dlls/vbscript/global.c
+10
-2
api.vbs
dlls/vbscript/tests/api.vbs
+9
-0
No files found.
dlls/vbscript/global.c
View file @
48a86230
...
...
@@ -150,12 +150,20 @@ static HRESULT to_int(VARIANT *v, int *ret)
*
ret
=
V_I4
(
v
);
break
;
case
VT_R8
:
{
double
n
=
round
(
V_R8
(
v
));
double
n
=
floor
(
V_R8
(
v
)
+
0
.
5
);
INT32
i
;
if
(
!
is_int32
(
n
))
{
FIXME
(
"%lf is out of int range
\n
"
,
n
);
return
E_FAIL
;
}
*
ret
=
n
;
/* Round half to even */
i
=
n
;
if
(
i
%
2
&&
n
-
V_R8
(
v
)
==
0
.
5
)
i
--
;
*
ret
=
i
;
break
;
}
case
VT_BOOL
:
...
...
dlls/vbscript/tests/api.vbs
View file @
48a86230
...
...
@@ -134,6 +134,8 @@ Call ok(getVT(Chr(120)) = "VT_BSTR", "getVT(Chr(120)) = " & getVT(Chr(120)))
Call
ok
(
getVT
(
Chr
(
255
))
=
"VT_BSTR"
,
"getVT(Chr(255)) = "
&
getVT
(
Chr
(
255
)))
Call
ok
(
Chr
(
120
)
=
"x"
,
"Chr(120) = "
&
Chr
(
120
))
Call
ok
(
Chr
(
0
)
<>
""
,
"Chr(0) =
""""
"
)
Call
ok
(
Chr
(
120.5
)
=
"x"
,
"Chr(120.5) = "
&
Chr
(
120.5
))
Call
ok
(
Chr
(
119.5
)
=
"x"
,
"Chr(119.5) = "
&
Chr
(
119.5
))
Call
ok
(
isObject
(
new
EmptyClass
),
"isObject(new EmptyClass) is not true?"
)
Set
x
=
new
EmptyClass
...
...
@@ -292,6 +294,9 @@ Call ok(Space(5) = " ", "Space(5) = " & Space(5) & """")
Call
ok
(
Space
(
5.2
)
=
" "
,
"Space(5.2) = "
&
Space
(
5.2
)
&
"
""
"
)
Call
ok
(
Space
(
5.8
)
=
" "
,
"Space(5.8) = "
&
Space
(
5.8
)
&
"
""
"
)
Call
ok
(
Space
(
5.5
)
=
" "
,
"Space(5.5) = "
&
Space
(
5.5
)
&
"
""
"
)
Call
ok
(
Space
(
4.5
)
=
" "
,
"Space(4.5) = "
&
Space
(
4.5
)
&
"
""
"
)
Call
ok
(
Space
(
0.5
)
=
""
,
"Space(0.5) = "
&
Space
(
0.5
)
&
"
""
"
)
Call
ok
(
Space
(
1.5
)
=
" "
,
"Space(1.5) = "
&
Space
(
1.5
)
&
"
""
"
)
Sub
TestStrReverse
(
str
,
ex
)
Call
ok
(
StrReverse
(
str
)
=
ex
,
"StrReverse("
&
str
&
") = "
&
StrReverse
(
str
))
...
...
@@ -310,6 +315,8 @@ TestLeft "test", 2, "te"
TestLeft
"test"
,
5
,
"test"
TestLeft
"test"
,
0
,
""
TestLeft
123
,
2
,
"12"
TestLeft
"123456"
,
1.5
,
"12"
TestLeft
"123456"
,
2.5
,
"12"
if
isEnglishLang
then
TestLeft
true
,
2
,
"Tr"
Sub
TestRight
(
str
,
len
,
ex
)
...
...
@@ -383,6 +390,8 @@ if isEnglishLang then
Call
ok
(
WeekDayName
(
1
,
10
)
=
"Sun"
,
"WeekDayName(1, 10) = "
&
WeekDayName
(
1
,
10
))
Call
ok
(
WeekDayName
(
1
,
true
,
0
)
=
"Sun"
,
"WeekDayName(1, true, 0) = "
&
WeekDayName
(
1
,
true
,
0
))
Call
ok
(
WeekDayName
(
1
,
true
,
2
)
=
"Mon"
,
"WeekDayName(1, true, 2) = "
&
WeekDayName
(
1
,
true
,
2
))
Call
ok
(
WeekDayName
(
1
,
true
,
2.5
)
=
"Mon"
,
"WeekDayName(1, true, 2.5) = "
&
WeekDayName
(
1
,
true
,
2.5
))
Call
ok
(
WeekDayName
(
1
,
true
,
1.5
)
=
"Mon"
,
"WeekDayName(1, true, 1.5) = "
&
WeekDayName
(
1
,
true
,
1.5
))
Call
ok
(
WeekDayName
(
1
,
true
,
7
)
=
"Sat"
,
"WeekDayName(1, true, 7) = "
&
WeekDayName
(
1
,
true
,
7
))
Call
ok
(
WeekDayName
(
1
,
true
,
7.1
)
=
"Sat"
,
"WeekDayName(1, true, 7.1) = "
&
WeekDayName
(
1
,
true
,
7.1
))
...
...
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