{"ScriptPreparationCode":"let factorialize = function (num) {\r\n if (num === 0 || num === 1)\r\n return 1;\r\n for (let i = num - 1; i \u003E= 1; i--) {\r\n num *= i;\r\n }\r\n return num;\r\n}\r\n\r\nlet FACT_2 = 1 / factorialize(2);\r\nlet FACT_3 = 1 / factorialize(3);\r\nlet FACT_4 = 1 / factorialize(4);\r\nlet FACT_5 = 1 / factorialize(5);\r\nlet FACT_6 = 1 / factorialize(6);\r\nlet FACT_7 = 1 / factorialize(7);\r\n\r\nconst HALF_PI = Math.PI * 0.5;\r\nconst DOUBLE_PI = Math.PI * 2;\r\n\r\nvar mysin = function (angle)\r\n{\r\n let pow2 = angle * angle;\r\n let pow4 = pow2 * pow2;\r\n let pow6 = pow4 * pow2;\r\n return 1 - pow2 * FACT_2 \u002B pow4 * FACT_4 - pow6 * FACT_6;\r\n}\r\n\r\nvar mycos = function (angle)\r\n{\r\n return mysin(angle \u002B HALF_PI);\r\n}\r\n\r\nvar fastSin = function (x)\r\n{\r\n if (x \u003C -Math.PI)\r\n x \u002B= DOUBLE_PI;\r\n else if (x \u003E Math.PI)\r\n x -= DOUBLE_PI;\r\n\r\n if (x \u003C 0)\r\n return 1.27323954 * x \u002B 0.405284735 * x * x;\r\n else\r\n return 1.27323954 * x - 0.405284735 * x * x;\r\n}\r\n\r\nvar fastCos = function (x)\r\n{\r\n return fastSin(x \u002B HALF_PI);\r\n}","TestCases":[{"Name":"Math","Code":"Math.cos(0.4292);\r\nMath.sin(0.2321);","IsDeferred":false},{"Name":"Faster","Code":"mycos(0.4292);\r\nmysin(0.2321);","IsDeferred":false},{"Name":"Fastest","Code":"fastCos(0.4292);\r\nfastSin(0.2321);","IsDeferred":false}]}