test262/website/resources/scripts/testcases2/15.8.2.4_atan.json

45 lines
6.4 KiB
JSON

{
"testCollection": {
"name": "15.8.2.4_atan",
"numTests": 6,
"tests": [
{
"section": "15.8.2.4",
"description": "Checking if Math.atan(NaN) is NaN",
"test": "// CHECK#1\nvar x = NaN;\nif (!isNaN(Math.atan(x)))\n{\n\t$ERROR(\"#1: 'var x=NaN; isNaN(Math.atan(x)) === false'\");\n}\n",
"id": "S15.8.2.4_A1"
},
{
"section": "15.8.2.4",
"description": "Checking if Math.atan(+0) equals to +0",
"test": "// CHECK#1\nvar x = +0;\nif (Math.atan(x) !== +0)\n{\n\t$ERROR(\"#1: 'var x = +0; Math.atan(x) !== +0'\");\n}\n",
"id": "S15.8.2.4_A2"
},
{
"section": "15.8.2.4",
"description": "Checking if Math.atan(-0) equals to -0",
"test": "// CHECK#1\nvar x = -0;\nif (Math.atan(x) !== -0)\n{\n\t$ERROR(\"#1: 'var x = -0; Math.atan(x) !== -0'\");\n}\n",
"id": "S15.8.2.4_A3"
},
{
"section": "15.8.2.4",
"description": "Checking if Math.atan(+Infinity) is an approximation to +PI/2",
"test": "$INCLUDE(\"math_precision.js\");\n$INCLUDE(\"math_isequal.js\"); \n \n// CHECK#1\n\nvar x = +Infinity;\nif (!isEqual(Math.atan(x),Math.PI/2))\n{\n\t$ERROR(\"#1: '!isEqual(Math.atan(+Infinity), Math.PI/2)'\");\n}\n",
"id": "S15.8.2.4_A4"
},
{
"section": "15.8.2.4",
"description": "Checking if Math.atan(-Infinity) is an approximation to -PI/2",
"test": "$INCLUDE(\"math_precision.js\");\n$INCLUDE(\"math_isequal.js\"); \n \n// CHECK#1\n\nvar x = -Infinity;\nif (!isEqual(Math.atan(x), -Math.PI/2))\n{\n\t$ERROR(\"#1: '!isEqual(Math.atan(-Infinity), -Math.PI/2)'\");\n}\n",
"id": "S15.8.2.4_A5"
},
{
"section": "15.8.2.4",
"description": ": Checking if Math.atan is approximately equals to its mathematical values on the set of 64 argument values; all the sample values is calculated with LibC;",
"test": "$INCLUDE(\"math_precision.js\");\n$INCLUDE(\"math_isequal.js\");\n\n// CHECK#1\nvnum = 64;\nvar x = new Array();\nx[0] = -16.00000000000000000000;\nx[1] = -15.49206349206349200000;\nx[2] = -14.98412698412698400000;\nx[3] = -14.47619047619047600000;\nx[4] = -13.96825396825396800000;\nx[5] = -13.46031746031746000000;\nx[6] = -12.95238095238095300000;\nx[7] = -12.44444444444444500000;\nx[8] = -11.93650793650793700000;\nx[9] = -11.42857142857142900000;\nx[10] = -10.92063492063492100000;\nx[11] = -10.41269841269841300000;\nx[12] = -9.90476190476190510000;\nx[13] = -9.39682539682539720000;\nx[14] = -8.88888888888888930000;\nx[15] = -8.38095238095238140000;\nx[16] = -7.87301587301587350000;\nx[17] = -7.36507936507936560000;\nx[18] = -6.85714285714285770000;\nx[19] = -6.34920634920634970000;\nx[20] = -5.84126984126984180000;\nx[21] = -5.33333333333333390000;\nx[22] = -4.82539682539682600000;\nx[23] = -4.31746031746031810000;\nx[24] = -3.80952380952381020000;\nx[25] = -3.30158730158730230000;\nx[26] = -2.79365079365079440000;\nx[27] = -2.28571428571428650000;\nx[28] = -1.77777777777777860000;\nx[29] = -1.26984126984127070000;\nx[30] = -0.76190476190476275000;\nx[31] = -0.25396825396825484000;\nx[32] = 0.25396825396825307000;\nx[33] = 0.76190476190476275000;\nx[34] = 1.26984126984126890000;\nx[35] = 1.77777777777777860000;\nx[36] = 2.28571428571428470000;\nx[37] = 2.79365079365079440000;\nx[38] = 3.30158730158730050000;\nx[39] = 3.80952380952381020000;\nx[40] = 4.31746031746031630000;\nx[41] = 4.82539682539682600000;\nx[42] = 5.33333333333333210000;\nx[43] = 5.84126984126984180000;\nx[44] = 6.34920634920634800000;\nx[45] = 6.85714285714285770000;\nx[46] = 7.36507936507936380000;\nx[47] = 7.87301587301587350000;\nx[48] = 8.38095238095237960000;\nx[49] = 8.88888888888888930000;\nx[50] = 9.39682539682539540000;\nx[51] = 9.90476190476190510000;\nx[52] = 10.41269841269841100000;\nx[53] = 10.92063492063492100000;\nx[54] = 11.42857142857142700000;\nx[55] = 11.93650793650793700000;\nx[56] = 12.44444444444444300000;\nx[57] = 12.95238095238095300000;\nx[58] = 13.46031746031745900000;\nx[59] = 13.96825396825396800000;\nx[60] = 14.47619047619047400000;\nx[61] = 14.98412698412698400000;\nx[62] = 15.49206349206349000000;\nx[63] = 16.00000000000000000000;\n\n\n\nvar y = new Array();\ny[0] = -1.50837751679893930000;\ny[1] = -1.50633657314382670000;\ny[2] = -1.50415785436419310000;\ny[3] = -1.50182694519358660000;\ny[4] = -1.49932735026103090000;\ny[5] = -1.49664010557682300000;\ny[6] = -1.49374329974393950000;\ny[7] = -1.49061147949358030000;\ny[8] = -1.48721490565349580000;\ny[9] = -1.48351861384543530000;\ny[10] = -1.47948121756761840000;\ny[11] = -1.47505336756015580000;\ny[12] = -1.47017574693777100000;\ny[13] = -1.46477643093971600000;\ny[14] = -1.45876736436890870000;\ny[15] = -1.45203959426707030000;\ny[16] = -1.44445671565255360000;\ny[17] = -1.43584570229039390000;\ny[18] = -1.42598382855595760000;\ny[19] = -1.41457960835077490000;\ny[20] = -1.40124433129607070000;\ny[21] = -1.38544837679920190000;\ny[22] = -1.36645204745321510000;\ny[23] = -1.34319210978762000000;\ny[24] = -1.31408799636151090000;\ny[25] = -1.27669520176831860000;\ny[26] = -1.22705270315911450000;\ny[27] = -1.15838588519750950000;\ny[28] = -1.05840686648415900000;\ny[29] = -0.90372394590298166000;\ny[30] = -0.65107672144448037000;\ny[31] = -0.24870998909352368000;\ny[32] = 0.24870998909352202000;\ny[33] = 0.65107672144448037000;\ny[34] = 0.90372394590298100000;\ny[35] = 1.05840686648415900000;\ny[36] = 1.15838588519750910000;\ny[37] = 1.22705270315911450000;\ny[38] = 1.27669520176831840000;\ny[39] = 1.31408799636151090000;\ny[40] = 1.34319210978761980000;\ny[41] = 1.36645204745321510000;\ny[42] = 1.38544837679920190000;\ny[43] = 1.40124433129607070000;\ny[44] = 1.41457960835077490000;\ny[45] = 1.42598382855595760000;\ny[46] = 1.43584570229039390000;\ny[47] = 1.44445671565255360000;\ny[48] = 1.45203959426707030000;\ny[49] = 1.45876736436890870000;\ny[50] = 1.46477643093971600000;\ny[51] = 1.47017574693777100000;\ny[52] = 1.47505336756015580000;\ny[53] = 1.47948121756761840000;\ny[54] = 1.48351861384543530000;\ny[55] = 1.48721490565349580000;\ny[56] = 1.49061147949358030000;\ny[57] = 1.49374329974393950000;\ny[58] = 1.49664010557682300000;\ny[59] = 1.49932735026103090000;\ny[60] = 1.50182694519358660000;\ny[61] = 1.50415785436419310000;\ny[62] = 1.50633657314382670000;\ny[63] = 1.50837751679893930000;\n\n\n\n\nvar val;\nfor (i = 0; i < vnum; i++)\n{\n\tval = Math.atan(x[i]);\n\tif (!isEqual(val, y[i]))\n\t{\n\t\t$ERROR(\"\\nx = \" + x[i] + \"\\nlibc.atan(x) = \" + y[i] + \"\\nMath.atan(x) = \" + Math.atan(x[i]) + \"\\nMath.abs(libc.atan(x) - Math.atan(x)) > \" + prec + \"\\n\\n\"); \n\t}\n}\n",
"id": "S15.8.2.4_A6"
}
]
}
}