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
a20a9166
Commit
a20a9166
authored
Jan 22, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 22, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Math.random implementation.
parent
890a48ad
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
Makefile.in
dlls/jscript/Makefile.in
+1
-1
math.c
dlls/jscript/math.c
+14
-2
api.js
dlls/jscript/tests/api.js
+8
-0
No files found.
dlls/jscript/Makefile.in
View file @
a20a9166
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
jscript.dll
IMPORTS
=
oleaut32 kernel32
IMPORTS
=
oleaut32
advapi32
kernel32
RC_SRCS
=
rsrc.rc
...
...
dlls/jscript/math.c
View file @
a20a9166
...
...
@@ -20,8 +20,10 @@
#include "wine/port.h"
#include <math.h>
#include <limits.h>
#include "jscript.h"
#include "ntsecapi.h"
#include "wine/debug.h"
...
...
@@ -352,11 +354,21 @@ static HRESULT Math_pow(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *d
return
S_OK
;
}
/* ECMA-262 3rd Edition 15.8.2.14 */
static
HRESULT
Math_random
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
UINT
r
;
TRACE
(
"
\n
"
);
if
(
!
RtlGenRandom
(
&
r
,
sizeof
(
r
)))
return
E_UNEXPECTED
;
if
(
retv
)
num_set_val
(
retv
,
(
DOUBLE
)
r
/
(
DOUBLE
)
UINT_MAX
);
return
S_OK
;
}
/* ECMA-262 3rd Edition 15.8.2.15 */
...
...
dlls/jscript/tests/api.js
View file @
a20a9166
...
...
@@ -585,6 +585,14 @@ ok(tmp === 2, "Math.pow(2, 2) = " + tmp);
tmp
=
Math
.
pow
(
2
,
2
,
3
);
ok
(
tmp
===
4
,
"Math.pow(2, 2, 3) = "
+
tmp
);
tmp
=
Math
.
random
();
ok
(
typeof
(
tmp
)
==
"number"
,
"typeof(tmp) = "
+
typeof
(
tmp
));
ok
(
0
<=
tmp
&&
tmp
<=
1
,
"Math.random() = "
+
tmp
);
tmp
=
Math
.
random
(
100
);
ok
(
typeof
(
tmp
)
==
"number"
,
"typeof(tmp) = "
+
typeof
(
tmp
));
ok
(
0
<=
tmp
&&
tmp
<=
1
,
"Math.random(100) = "
+
tmp
);
var
func
=
function
(
a
)
{
var
a
=
1
;
if
(
a
)
return
;
...
...
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