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
9de9c353
Commit
9de9c353
authored
Dec 17, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Fixed Number.toFixed for value 0 with 0 precision.
parent
59e339fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
number.c
dlls/jscript/number.c
+4
-2
api.js
dlls/jscript/tests/api.js
+8
-0
No files found.
dlls/jscript/number.c
View file @
9de9c353
...
@@ -99,15 +99,17 @@ static inline jsstr_t *number_to_fixed(double val, int prec)
...
@@ -99,15 +99,17 @@ static inline jsstr_t *number_to_fixed(double val, int prec)
jsstr_t
*
ret
;
jsstr_t
*
ret
;
WCHAR
*
str
;
WCHAR
*
str
;
TRACE
(
"%lf %d
\n
"
,
val
,
prec
);
if
(
val
<
0
)
{
if
(
val
<
0
)
{
neg
=
TRUE
;
neg
=
TRUE
;
val
=
-
val
;
val
=
-
val
;
}
}
if
(
val
<=-
1
||
val
>=
1
)
if
(
val
>=
1
)
buf_size
=
log10
(
val
)
+
prec
+
2
;
buf_size
=
log10
(
val
)
+
prec
+
2
;
else
else
buf_size
=
prec
+
1
;
buf_size
=
prec
?
prec
+
1
:
2
;
if
(
buf_size
>
NUMBER_DTOA_SIZE
)
if
(
buf_size
>
NUMBER_DTOA_SIZE
)
buf_size
=
NUMBER_DTOA_SIZE
;
buf_size
=
NUMBER_DTOA_SIZE
;
...
...
dlls/jscript/tests/api.js
View file @
9de9c353
...
@@ -1204,6 +1204,14 @@ ok(tmp === "101.1", "num(5.5).toString(2) = " + tmp);
...
@@ -1204,6 +1204,14 @@ ok(tmp === "101.1", "num(5.5).toString(2) = " + tmp);
tmp
=
(
new
Number
(
3
)).
toFixed
(
3
);
tmp
=
(
new
Number
(
3
)).
toFixed
(
3
);
ok
(
tmp
===
"3.000"
,
"num(3).toFixed(3) = "
+
tmp
);
ok
(
tmp
===
"3.000"
,
"num(3).toFixed(3) = "
+
tmp
);
tmp
=
(
new
Number
(
3
)).
toFixed
();
ok
(
tmp
===
"3"
,
"Number(3).toFixed() = "
+
tmp
);
tmp
=
(
new
Number
(
0
)).
toFixed
();
ok
(
tmp
===
"0"
,
"Number(0).toFixed() = "
+
tmp
);
tmp
=
(
new
Number
(
0
)).
toFixed
(
1
);
ok
(
tmp
===
"0.0"
,
"Number(0).toFixed(1) = "
+
tmp
);
tmp
=
(
new
Number
(
0
)).
toFixed
(
2
);
ok
(
tmp
===
"0.00"
,
"Number(0).toFixed(2) = "
+
tmp
);
tmp
=
(
new
Number
(
1.76
)).
toFixed
(
1
);
tmp
=
(
new
Number
(
1.76
)).
toFixed
(
1
);
ok
(
tmp
===
"1.8"
,
"num(1.76).toFixed(1) = "
+
tmp
);
ok
(
tmp
===
"1.8"
,
"num(1.76).toFixed(1) = "
+
tmp
);
tmp
=
(
new
Number
(
7.92
)).
toFixed
(
5
);
tmp
=
(
new
Number
(
7.92
)).
toFixed
(
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