Jacek Caban : jscript: Added Math.LOG2E implementation.

Alexandre Julliard julliard at winehq.org
Thu Dec 11 07:50:53 CST 2008


Module: wine
Branch: master
Commit: 0c6b427aaae1a228c95052725f1e38c55f7e878e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0c6b427aaae1a228c95052725f1e38c55f7e878e

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Dec 11 12:28:12 2008 +0100

jscript: Added Math.LOG2E implementation.

---

 dlls/jscript/math.c       |   11 ++++++-----
 dlls/jscript/tests/api.js |    5 +++++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/dlls/jscript/math.c b/dlls/jscript/math.c
index fd8bb55..93e1ee4 100644
--- a/dlls/jscript/math.c
+++ b/dlls/jscript/math.c
@@ -77,11 +77,12 @@ static HRESULT Math_E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
     return math_constant(M_E, flags, retv);
 }
 
+/* ECMA-262 3rd Edition    15.8.1.4 */
 static HRESULT Math_LOG2E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
         VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    TRACE("\n");
+    return math_constant(M_LOG2E, flags, retv);
 }
 
 static HRESULT Math_LOG10E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
@@ -403,10 +404,10 @@ static HRESULT Math_tan(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *d
 
 static const builtin_prop_t Math_props[] = {
     {EW,        Math_E,        0},
-    {LOG2EW,    Math_LOG2E,    0},
-    {LOG10EW,   Math_LOG10E,   0},
-    {LN2W,      Math_LN2,      0},
     {LN10W,     Math_LN10,     0},
+    {LN2W,      Math_LN2,      0},
+    {LOG10EW,   Math_LOG10E,   0},
+    {LOG2EW,    Math_LOG2E,    0},
     {PIW,       Math_PI,       0},
     {SQRT1_2W,  Math_SQRT1_2,  0},
     {SQRT2W,    Math_SQRT2,    0},
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index 169bc94..71a1518 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -619,4 +619,9 @@ ok(Math.floor(Math.E*100) === 271, "Math.E = " + Math.E);
 Math.E = "test";
 ok(Math.floor(Math.E*100) === 271, "modified Math.E = " + Math.E);
 
+ok(typeof(Math.LOG2E) === "number", "typeof(Math.LOG2E) = " + typeof(Math.LOG2E));
+ok(Math.floor(Math.LOG2E*100) === 144, "Math.LOG2E = " + Math.LOG2E);
+Math.LOG2E = "test";
+ok(Math.floor(Math.LOG2E*100) === 144, "modified Math.LOG2E = " + Math.LOG2E);
+
 reportSuccess();




More information about the wine-cvs mailing list