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
c4fe1b2e
Commit
c4fe1b2e
authored
Sep 21, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 22, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Math.pow implementation.
parent
37b69e9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
math.c
dlls/jscript/math.c
+22
-2
api.js
dlls/jscript/tests/api.js
+9
-0
No files found.
dlls/jscript/math.c
View file @
c4fe1b2e
...
...
@@ -272,11 +272,31 @@ static HRESULT Math_min(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *d
return
S_OK
;
}
/* ECMA-262 3rd Edition 15.8.2.13 */
static
HRESULT
Math_pow
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
VARIANT
x
,
y
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
if
(
arg_cnt
(
dp
)
<
2
)
{
FIXME
(
"unimplemented arg_cnt %d
\n
"
,
arg_cnt
(
dp
));
return
E_NOTIMPL
;
}
hres
=
to_number
(
dispex
->
ctx
,
get_arg
(
dp
,
0
),
ei
,
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_number
(
dispex
->
ctx
,
get_arg
(
dp
,
1
),
ei
,
&
y
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
retv
)
num_set_val
(
retv
,
pow
(
num_val
(
&
x
),
num_val
(
&
y
)));
return
S_OK
;
}
static
HRESULT
Math_random
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
...
...
dlls/jscript/tests/api.js
View file @
c4fe1b2e
...
...
@@ -291,4 +291,13 @@ ok(tmp === 1, "Math.abs(true) = " + tmp);
tmp
=
Math
.
abs
(
-
3
,
2
);
ok
(
tmp
===
3
,
"Math.abs(-3, 2) = "
+
tmp
);
tmp
=
Math
.
pow
(
2
,
2
);
ok
(
tmp
===
4
,
"Math.pow(2, 2) = "
+
tmp
);
tmp
=
Math
.
pow
(
4
,
0.5
);
ok
(
tmp
===
2
,
"Math.pow(2, 2) = "
+
tmp
);
tmp
=
Math
.
pow
(
2
,
2
,
3
);
ok
(
tmp
===
4
,
"Math.pow(2, 2, 3) = "
+
tmp
);
reportSuccess
();
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