Commit 77fe488a authored by Shuai Meng's avatar Shuai Meng Committed by Alexandre Julliard

vbscript: Implemented Sin.

parent f97491cf
......@@ -681,8 +681,14 @@ static HRESULT Global_Cos(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
static HRESULT Global_Sin(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
HRESULT hres;
double d;
hres = to_double(arg, &d);
if(FAILED(hres))
return hres;
return return_double(res, sin(d));
}
static HRESULT Global_Tan(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
......
......@@ -1115,4 +1115,31 @@ Call ok(getVT(Cos(True)) = "VT_R8", "getVT(Cos(True)) = " & getVT(Cos(True)))
Call ok(Approch(Cos(CByte(255)), -0.8623), "Cos(CByte(255)) = " & Cos(CByte(255)))
Call ok(getVT(Cos(CByte(255))) = "VT_R8", "getVT(Cos(CByte(255))) = " & getVT(Cos(CByte(255))))
Call ok(Approch(Sin(Empty), 0), "Sin(Empty) = " & Sin(Empty))
Call ok(getVT(Sin(Empty)) = "VT_R8", "getVT(Sin(Empty)) = " & getVT(Sin(Empty)))
Call ok(Approch(Sin(PI / 6), 1 / 2), "Sin(PI / 6) = " & Sin(PI / 6))
Call ok(getVT(Sin(PI / 6)) = "VT_R8", "getVT(Sin(PI / 6)) = " & getVT(Sin(PI / 6)))
Call ok(Approch(Sin(CCur(PI / 4)), Sqr(2) / 2), "Sin(CCur(PI / 4)) = " & Sin(CCur(PI / 4)))
Call ok(getVT(Sin(CCur(PI / 4))) = "VT_R8", "getVT(Sin(CCur(PI / 4))) = " & getVT(Sin(CCur(PI / 4))))
Call ok(Approch(Sin(CSng(PI / 3)), Sqr(3) / 2), "Sin(CSng(PI / 3)) = " & Sin(CSng(PI / 3)))
Call ok(getVT(Sin(CSng(PI / 3))) = "VT_R8", "getVT(Sin(CSng(PI))) = " & getVT(Sin(CSng(PI))))
Call ok(Approch(Sin(PI / 2), 1), "Sin(0) = " & Sin(PI / 2))
Call ok(getVT(Sin(PI / 2)) = "VT_R8", "getVT(Sin(PI / 2)) = " & getVT(Sin(PI / 2)))
Call ok(Approch(Sin(PI), 0), "Sin(PI) = " & Sin(PI))
Call ok(getVT(Sin(PI)) = "VT_R8", "getVT(Sin(PI)) = " & getVT(Sin(PI)))
Call ok(Approch(Sin(5 * PI / 4), -Sqr(2) / 2), "Sin(5 * PI / 4) = " & Sin(5 * PI / 4))
Call ok(getVT(Sin(5 * PI / 4)) = "VT_R8", "getVT(Sin(5 * PI / 4)) = " & getVT(Sin(5 * PI / 4)))
Call ok(Approch(Sin(3 * PI / 2), -1), "Sin(3 * PI / 2) = " & Sin(3 * PI / 2))
Call ok(getVT(Sin(3 * PI / 2)) = "VT_R8", "getVT(Sin(3 * PI / 2)) = " & getVT(Sin(3 * PI / 2)))
Call ok(Approch(Sin(2 * PI), 0), "Sin(2 * PI) = " & Sin(2 * PI))
Call ok(getVT(Sin(2 * PI)) = "VT_R8", "getVT(Sin(2 * PI)) = " & getVT(Sin(2 * PI)))
Call ok(Approch(Sin("-32768"), -0.9278), "Sin(""-32768"") = " & Sin("-32768"))
Call ok(getVT(Sin("-32768")) = "VT_R8", "getVT(Sin(""-32768"")) = " & getVT(Sin("-32768")))
Call ok(Approch(Sin(False), 0), "Sin(False) = " & Sin(False))
Call ok(getVT(Sin(False)) = "VT_R8", "getVT(Sin(False)) = " & getVT(Sin(False)))
Call ok(Approch(Sin(True), -0.84147), "Sin(True) = " & Sin(True))
Call ok(getVT(Sin(True)) = "VT_R8", "getVT(Sin(True)) = " & getVT(Sin(True)))
Call ok(Approch(Sin(CByte(255)), -0.5063), "Sin(CByte(255)) = " & Sin(CByte(255)))
Call ok(getVT(Sin(CByte(255))) = "VT_R8", "getVT(Sin(CByte(255))) = " & getVT(Sin(CByte(255))))
Call reportSuccess()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment