static const WCHAR sqrtW[] = {'s','q','r','t',0};
static const WCHAR tanW[] = {'t','a','n',0};
+static HRESULT math_constant(DOUBLE val, WORD flags, VARIANT *retv)
+{
+ switch(flags) {
+ case DISPATCH_PROPERTYGET:
+ V_VT(retv) = VT_R8;
+ V_R8(retv) = val;
+ return S_OK;
+ case DISPATCH_PROPERTYPUT:
+ return S_OK;
+ }
+
+ FIXME("unhandled flags %x\n", flags);
+ return E_NOTIMPL;
+}
+
static HRESULT Math_E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
return E_NOTIMPL;
}
+/* ECMA-262 3rd Edition 15.8.1.6 */
static HRESULT Math_PI(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_PI, flags, retv);
}
static HRESULT Math_SQRT2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
ok(date.getTime() === 100, "date.getTime() = " + date.getTime());
ok(Date.prototype.getTime() === 0, "date.prototype.getTime() = " + Date.prototype.getTime());
+ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI));
+ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);
+Math.PI = "test";
+ok(Math.floor(Math.PI*100) === 314, "modified Math.PI = " + Math.PI);
+
reportSuccess();