Skip to content
Snippets Groups Projects
Commit f7aa31b4 authored by Mike Pennisi's avatar Mike Pennisi Committed by Leonardo Balter
Browse files

Remove over-specified tests

Except for a small set of expected input/output pairs, both ES5 and
ES2015 define the expected return value of these methods in terms of an
"implementation-dependent approximation." This makes it inappropriate to
enforce expectations for specific values, even if expressed imprecisely.
parent 26676bea
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 887 deletions
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Math.E is approximately 2.7182818284590452354
es5id: 15.8.1.1_A1
description: Comparing Math.E with 2.7182818284590452354
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
if (!isEqual(Math.E, 2.7182818284590452354)) {
$ERROR('#1: \'Math.E is not approximately equal to 2.7182818284590452354\'');
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Math.LN10 is approximately 2.302585092994046
es5id: 15.8.1.2_A1
description: Comparing Math.LN10 with 2.302585092994046
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
if (!isEqual(Math.LN10, 2.302585092994046)) {
$ERROR('#1: \'Math.LN10 is not approximately equal to 2.302585092994046\'');
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Math.LN2 is approximately 0.6931471805599453
es5id: 15.8.1.3_A1
description: Comparing Math.LN2 with 0.6931471805599453
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
if (!isEqual(Math.LN2, 0.6931471805599453)) {
$ERROR('#1: \'Math.LN2 is not approximately equal to 0.6931471805599453\'');
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Math.LOG10E is approximately 0.4342944819032518
es5id: 15.8.1.5_A1
description: Comparing Math.LOG10E with 0.4342944819032518
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
if (!isEqual(Math.LOG10E, 0.4342944819032518)) {
$ERROR('#1: \'Math.LOG10E is not approximatley equal to 0.4342944819032518\'');
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Math.LOG2E is approximately 1.4426950408889634
es5id: 15.8.1.4_A1
description: Comparing Math.LOG2E with 1.4426950408889634
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
if (!isEqual(Math.LOG2E, 1.4426950408889634)) {
$ERROR('#1: \'Math.LOG2E is not approximatley equal to 1.4426950408889634\'');
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Math.PI is approximately 3.1415926535897932
es5id: 15.8.1.6_A1
description: Comparing Math.PI with 3.1415926535897932
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
if (!isEqual(Math.PI, 3.1415926535897932)) {
$ERROR('#1: \'Math.PI is not approximatley equal to 3.1415926535897932\'');
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Math.SQRT1_2 is approximately 0.7071067811865476
es5id: 15.8.1.7_A1
description: Comparing Math.SQRT1_2 with 0.7071067811865476
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
if (!isEqual(Math.SQRT1_2, 0.7071067811865476)) {
$ERROR('#1: \'Math.SQRT1_2 is not approximatley equal to 0.7071067811865476\'');
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Math.SQRT2 is approximately 1.4142135623730951
es5id: 15.8.1.8_A1
description: Comparing Math.SQRT2 with 1.4142135623730951
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
if (!isEqual(Math.SQRT2, 1.4142135623730951)) {
$ERROR('#1: \'Math.SQRT2 is not approximatley equal to 1.4142135623730951\'');
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
Math.acos, recommended that implementations use the approximation
algorithms for IEEE 754 arithmetic contained in fdlibm
es5id: 15.8.2.2_A5
description: >
Checking if Math.acos is approximately equals to its mathematical
values on the set of 64 argument values; all the sample values is
calculated with LibC
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var vnum = 64;
var x = new Array();
x[0] = -1.00000000000000000000;
x[1] = -0.96825396825396826000;
x[2] = -0.93650793650793651000;
x[3] = -0.90476190476190477000;
x[4] = -0.87301587301587302000;
x[5] = -0.84126984126984128000;
x[6] = -0.80952380952380953000;
x[7] = -0.77777777777777779000;
x[8] = -0.74603174603174605000;
x[9] = -0.71428571428571430000;
x[10] = -0.68253968253968256000;
x[11] = -0.65079365079365081000;
x[12] = -0.61904761904761907000;
x[13] = -0.58730158730158732000;
x[14] = -0.55555555555555558000;
x[15] = -0.52380952380952384000;
x[16] = -0.49206349206349209000;
x[17] = -0.46031746031746035000;
x[18] = -0.42857142857142860000;
x[19] = -0.39682539682539686000;
x[20] = -0.36507936507936511000;
x[21] = -0.33333333333333337000;
x[22] = -0.30158730158730163000;
x[23] = -0.26984126984126988000;
x[24] = -0.23809523809523814000;
x[25] = -0.20634920634920639000;
x[26] = -0.17460317460317465000;
x[27] = -0.14285714285714290000;
x[28] = -0.11111111111111116000;
x[29] = -0.07936507936507941600;
x[30] = -0.04761904761904767200;
x[31] = -0.01587301587301592800;
x[32] = 0.01587301587301581700;
x[33] = 0.04761904761904767200;
x[34] = 0.07936507936507930500;
x[35] = 0.11111111111111116000;
x[36] = 0.14285714285714279000;
x[37] = 0.17460317460317465000;
x[38] = 0.20634920634920628000;
x[39] = 0.23809523809523814000;
x[40] = 0.26984126984126977000;
x[41] = 0.30158730158730163000;
x[42] = 0.33333333333333326000;
x[43] = 0.36507936507936511000;
x[44] = 0.39682539682539675000;
x[45] = 0.42857142857142860000;
x[46] = 0.46031746031746024000;
x[47] = 0.49206349206349209000;
x[48] = 0.52380952380952372000;
x[49] = 0.55555555555555558000;
x[50] = 0.58730158730158721000;
x[51] = 0.61904761904761907000;
x[52] = 0.65079365079365070000;
x[53] = 0.68253968253968256000;
x[54] = 0.71428571428571419000;
x[55] = 0.74603174603174605000;
x[56] = 0.77777777777777768000;
x[57] = 0.80952380952380953000;
x[58] = 0.84126984126984117000;
x[59] = 0.87301587301587302000;
x[60] = 0.90476190476190466000;
x[61] = 0.93650793650793651000;
x[62] = 0.96825396825396814000;
x[63] = 1.00000000000000000000;
var y = new Array();
y[0] = 3.14159265358979310000;
y[1] = 2.88894492730522990000;
y[2] = 2.78333143507717650000;
y[3] = 2.70161669879887430000;
y[4] = 2.63214880477790030000;
y[5] = 2.57042415502425570000;
y[6] = 2.51413688066660250000;
y[7] = 2.46191883468154950000;
y[8] = 2.41287920284638750000;
y[9] = 2.36639928027943200000;
y[10] = 2.32202832592153240000;
y[11] = 2.27942559835728040000;
y[12] = 2.23832577143072960000;
y[13] = 2.19851714445280910000;
y[14] = 2.15982729701117070000;
y[15] = 2.12211329592677920000;
y[16] = 2.08525480235608330000;
y[17] = 2.04914909144415440000;
y[18] = 2.01370737086853560000;
y[19] = 1.97885200409617520000;
y[20] = 1.94451437773781040000;
y[21] = 1.91063323624901860000;
y[22] = 1.87715336135181590000;
y[23] = 1.84402450933553450000;
y[24] = 1.81120054356415610000;
y[25] = 1.77863871614824330000;
y[26] = 1.74629906437061930000;
y[27] = 1.71414389570026190000;
y[28] = 1.68213734113586070000;
y[29] = 1.65024496088003380000;
y[30] = 1.61843338941929970000;
y[31] = 1.58667000928485250000;
y[32] = 1.55492264430494110000;
y[33] = 1.52315926417049340000;
y[34] = 1.49134769270975950000;
y[35] = 1.45945531245393270000;
y[36] = 1.42744875788953140000;
y[37] = 1.39529358921917380000;
y[38] = 1.36295393744155000000;
y[39] = 1.33039211002563730000;
y[40] = 1.29756814425425880000;
y[41] = 1.26443929223797750000;
y[42] = 1.23095941734077470000;
y[43] = 1.19707827585198270000;
y[44] = 1.16274064949361830000;
y[45] = 1.12788528272125750000;
y[46] = 1.09244356214563900000;
y[47] = 1.05633785123370980000;
y[48] = 1.01947935766301390000;
y[49] = 0.98176535657862274000;
y[50] = 0.94307550913698401000;
y[51] = 0.90326688215906359000;
y[52] = 0.86216705523251280000;
y[53] = 0.81956432766826082000;
y[54] = 0.77519337331036142000;
y[55] = 0.72871345074340554000;
y[56] = 0.67967381890824408000;
y[57] = 0.62745577292319077000;
y[58] = 0.57116849856553775000;
y[59] = 0.50944384881189297000;
y[60] = 0.43997595479091917000;
y[61] = 0.35826121851261677000;
y[62] = 0.25264772628456394000;
y[63] = 0.00000000000000000000;
var val;
for (var i = 0; i < vnum; i++)
{
val = Math.acos(x[i]);
if (!isEqual(val, y[i]))
{
$ERROR("\nx = " + x[i] + "\nlibc.acos(x) = " + y[i] + "\nMath.acos(x) = " + Math.acos(x[i]) + "\nMath.abs(libc.acos(x) - Math.acos(x)) > " + prec + "\n\n");
}
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
Math.asin, recommended that implementations use the approximation
algorithms for IEEE 754 arithmetic contained in fdlibm
es5id: 15.8.2.3_A6
description: >
Checking if Math.asin is approximately equals to its mathematical
values on the set of 64 argument values; all the sample values is
calculated with LibC
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var vnum = 64;
var x = new Array();
x[0] = -1.00000000000000000000;
x[1] = -0.96825396825396826000;
x[2] = -0.93650793650793651000;
x[3] = -0.90476190476190477000;
x[4] = -0.87301587301587302000;
x[5] = -0.84126984126984128000;
x[6] = -0.80952380952380953000;
x[7] = -0.77777777777777779000;
x[8] = -0.74603174603174605000;
x[9] = -0.71428571428571430000;
x[10] = -0.68253968253968256000;
x[11] = -0.65079365079365081000;
x[12] = -0.61904761904761907000;
x[13] = -0.58730158730158732000;
x[14] = -0.55555555555555558000;
x[15] = -0.52380952380952384000;
x[16] = -0.49206349206349209000;
x[17] = -0.46031746031746035000;
x[18] = -0.42857142857142860000;
x[19] = -0.39682539682539686000;
x[20] = -0.36507936507936511000;
x[21] = -0.33333333333333337000;
x[22] = -0.30158730158730163000;
x[23] = -0.26984126984126988000;
x[24] = -0.23809523809523814000;
x[25] = -0.20634920634920639000;
x[26] = -0.17460317460317465000;
x[27] = -0.14285714285714290000;
x[28] = -0.11111111111111116000;
x[29] = -0.07936507936507941600;
x[30] = -0.04761904761904767200;
x[31] = -0.01587301587301592800;
x[32] = 0.01587301587301581700;
x[33] = 0.04761904761904767200;
x[34] = 0.07936507936507930500;
x[35] = 0.11111111111111116000;
x[36] = 0.14285714285714279000;
x[37] = 0.17460317460317465000;
x[38] = 0.20634920634920628000;
x[39] = 0.23809523809523814000;
x[40] = 0.26984126984126977000;
x[41] = 0.30158730158730163000;
x[42] = 0.33333333333333326000;
x[43] = 0.36507936507936511000;
x[44] = 0.39682539682539675000;
x[45] = 0.42857142857142860000;
x[46] = 0.46031746031746024000;
x[47] = 0.49206349206349209000;
x[48] = 0.52380952380952372000;
x[49] = 0.55555555555555558000;
x[50] = 0.58730158730158721000;
x[51] = 0.61904761904761907000;
x[52] = 0.65079365079365070000;
x[53] = 0.68253968253968256000;
x[54] = 0.71428571428571419000;
x[55] = 0.74603174603174605000;
x[56] = 0.77777777777777768000;
x[57] = 0.80952380952380953000;
x[58] = 0.84126984126984117000;
x[59] = 0.87301587301587302000;
x[60] = 0.90476190476190466000;
x[61] = 0.93650793650793651000;
x[62] = 0.96825396825396814000;
x[63] = 1.00000000000000000000;
var y = new Array();
y[0] = -1.57079632679489660000;
y[1] = -1.31814860051033310000;
y[2] = -1.21253510828227990000;
y[3] = -1.13082037200397780000;
y[4] = -1.06135247798300370000;
y[5] = -0.99962782822935903000;
y[6] = -0.94334055387170590000;
y[7] = -0.89112250788665281000;
y[8] = -0.84208287605149101000;
y[9] = -0.79560295348453536000;
y[10] = -0.75123199912663585000;
y[11] = -0.70862927156238398000;
y[12] = -0.66752944463583297000;
y[13] = -0.62772081765791266000;
y[14] = -0.58903097021627393000;
y[15] = -0.55131696913188277000;
y[16] = -0.51445847556118673000;
y[17] = -0.47835276464925774000;
y[18] = -0.44291104407363896000;
y[19] = -0.40805567730127851000;
y[20] = -0.37371805094291394000;
y[21] = -0.33983690945412198000;
y[22] = -0.30635703455691915000;
y[23] = -0.27322818254063785000;
y[24] = -0.24040421676925938000;
y[25] = -0.20784238935334678000;
y[26] = -0.17550273757572274000;
y[27] = -0.14334756890536540000;
y[28] = -0.11134101434096394000;
y[29] = -0.07944863408513722100;
y[30] = -0.04763706262440318300;
y[31] = -0.01587368248995573600;
y[32] = 0.01587368248995562500;
y[33] = 0.04763706262440318300;
y[34] = 0.07944863408513711000;
y[35] = 0.11134101434096394000;
y[36] = 0.14334756890536529000;
y[37] = 0.17550273757572274000;
y[38] = 0.20784238935334667000;
y[39] = 0.24040421676925938000;
y[40] = 0.27322818254063774000;
y[41] = 0.30635703455691915000;
y[42] = 0.33983690945412187000;
y[43] = 0.37371805094291394000;
y[44] = 0.40805567730127840000;
y[45] = 0.44291104407363896000;
y[46] = 0.47835276464925758000;
y[47] = 0.51445847556118673000;
y[48] = 0.55131696913188266000;
y[49] = 0.58903097021627393000;
y[50] = 0.62772081765791254000;
y[51] = 0.66752944463583297000;
y[52] = 0.70862927156238387000;
y[53] = 0.75123199912663585000;
y[54] = 0.79560295348453514000;
y[55] = 0.84208287605149101000;
y[56] = 0.89112250788665259000;
y[57] = 0.94334055387170590000;
y[58] = 0.99962782822935881000;
y[59] = 1.06135247798300370000;
y[60] = 1.13082037200397760000;
y[61] = 1.21253510828227990000;
y[62] = 1.31814860051033270000;
y[63] = 1.57079632679489660000;
var val;
for (var i = 0; i < vnum; i++)
{
val = Math.asin(x[i]);
if (!isEqual(val, y[i]))
{
$ERROR("\nx = " + x[i] + "\nlibc.asin(x) = " + y[i] + "\nMath.asin(x) = " + Math.asin(x[i]) + "\nMath.abs(libc.asin(x) - Math.asin(x)) > " + prec + "\n\n");
}
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
Math.atan, recommended that implementations use the approximation
algorithms for IEEE 754 arithmetic contained in fdlibm
es5id: 15.8.2.4_A6
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
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var vnum = 64;
var x = new Array();
x[0] = -16.00000000000000000000;
x[1] = -15.49206349206349200000;
x[2] = -14.98412698412698400000;
x[3] = -14.47619047619047600000;
x[4] = -13.96825396825396800000;
x[5] = -13.46031746031746000000;
x[6] = -12.95238095238095300000;
x[7] = -12.44444444444444500000;
x[8] = -11.93650793650793700000;
x[9] = -11.42857142857142900000;
x[10] = -10.92063492063492100000;
x[11] = -10.41269841269841300000;
x[12] = -9.90476190476190510000;
x[13] = -9.39682539682539720000;
x[14] = -8.88888888888888930000;
x[15] = -8.38095238095238140000;
x[16] = -7.87301587301587350000;
x[17] = -7.36507936507936560000;
x[18] = -6.85714285714285770000;
x[19] = -6.34920634920634970000;
x[20] = -5.84126984126984180000;
x[21] = -5.33333333333333390000;
x[22] = -4.82539682539682600000;
x[23] = -4.31746031746031810000;
x[24] = -3.80952380952381020000;
x[25] = -3.30158730158730230000;
x[26] = -2.79365079365079440000;
x[27] = -2.28571428571428650000;
x[28] = -1.77777777777777860000;
x[29] = -1.26984126984127070000;
x[30] = -0.76190476190476275000;
x[31] = -0.25396825396825484000;
x[32] = 0.25396825396825307000;
x[33] = 0.76190476190476275000;
x[34] = 1.26984126984126890000;
x[35] = 1.77777777777777860000;
x[36] = 2.28571428571428470000;
x[37] = 2.79365079365079440000;
x[38] = 3.30158730158730050000;
x[39] = 3.80952380952381020000;
x[40] = 4.31746031746031630000;
x[41] = 4.82539682539682600000;
x[42] = 5.33333333333333210000;
x[43] = 5.84126984126984180000;
x[44] = 6.34920634920634800000;
x[45] = 6.85714285714285770000;
x[46] = 7.36507936507936380000;
x[47] = 7.87301587301587350000;
x[48] = 8.38095238095237960000;
x[49] = 8.88888888888888930000;
x[50] = 9.39682539682539540000;
x[51] = 9.90476190476190510000;
x[52] = 10.41269841269841100000;
x[53] = 10.92063492063492100000;
x[54] = 11.42857142857142700000;
x[55] = 11.93650793650793700000;
x[56] = 12.44444444444444300000;
x[57] = 12.95238095238095300000;
x[58] = 13.46031746031745900000;
x[59] = 13.96825396825396800000;
x[60] = 14.47619047619047400000;
x[61] = 14.98412698412698400000;
x[62] = 15.49206349206349000000;
x[63] = 16.00000000000000000000;
var y = new Array();
y[0] = -1.50837751679893930000;
y[1] = -1.50633657314382670000;
y[2] = -1.50415785436419310000;
y[3] = -1.50182694519358660000;
y[4] = -1.49932735026103090000;
y[5] = -1.49664010557682300000;
y[6] = -1.49374329974393950000;
y[7] = -1.49061147949358030000;
y[8] = -1.48721490565349580000;
y[9] = -1.48351861384543530000;
y[10] = -1.47948121756761840000;
y[11] = -1.47505336756015580000;
y[12] = -1.47017574693777100000;
y[13] = -1.46477643093971600000;
y[14] = -1.45876736436890870000;
y[15] = -1.45203959426707030000;
y[16] = -1.44445671565255360000;
y[17] = -1.43584570229039390000;
y[18] = -1.42598382855595760000;
y[19] = -1.41457960835077490000;
y[20] = -1.40124433129607070000;
y[21] = -1.38544837679920190000;
y[22] = -1.36645204745321510000;
y[23] = -1.34319210978762000000;
y[24] = -1.31408799636151090000;
y[25] = -1.27669520176831860000;
y[26] = -1.22705270315911450000;
y[27] = -1.15838588519750950000;
y[28] = -1.05840686648415900000;
y[29] = -0.90372394590298166000;
y[30] = -0.65107672144448037000;
y[31] = -0.24870998909352368000;
y[32] = 0.24870998909352202000;
y[33] = 0.65107672144448037000;
y[34] = 0.90372394590298100000;
y[35] = 1.05840686648415900000;
y[36] = 1.15838588519750910000;
y[37] = 1.22705270315911450000;
y[38] = 1.27669520176831840000;
y[39] = 1.31408799636151090000;
y[40] = 1.34319210978761980000;
y[41] = 1.36645204745321510000;
y[42] = 1.38544837679920190000;
y[43] = 1.40124433129607070000;
y[44] = 1.41457960835077490000;
y[45] = 1.42598382855595760000;
y[46] = 1.43584570229039390000;
y[47] = 1.44445671565255360000;
y[48] = 1.45203959426707030000;
y[49] = 1.45876736436890870000;
y[50] = 1.46477643093971600000;
y[51] = 1.47017574693777100000;
y[52] = 1.47505336756015580000;
y[53] = 1.47948121756761840000;
y[54] = 1.48351861384543530000;
y[55] = 1.48721490565349580000;
y[56] = 1.49061147949358030000;
y[57] = 1.49374329974393950000;
y[58] = 1.49664010557682300000;
y[59] = 1.49932735026103090000;
y[60] = 1.50182694519358660000;
y[61] = 1.50415785436419310000;
y[62] = 1.50633657314382670000;
y[63] = 1.50837751679893930000;
var val;
for (var i = 0; i < vnum; i++)
{
val = Math.atan(x[i]);
if (!isEqual(val, y[i]))
{
$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");
}
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If y is -0 and x is -0, Math.atan2(y,x) is an implementation-dependent
approximation to -PI
es5id: 15.8.2.5_A10
description: Checking if Math.atan2(-0,-0) is an approximation to -PI
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
//prec = 0.00000000000001;
var y = -0;
var x = -0;
if (!isEqual(Math.atan2(y,x), -Math.PI))
$ERROR("#1: !isEqual(Math.atan2(-0,-0), -Math.PI)");
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If y is equal to -0 and x<0, Math.atan2(y,x) is an
implementation-dependent approximation to -PI
es5id: 15.8.2.5_A11
description: Checking if Math.atan2(-0,x) is an approximation to -PI, where x<0
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var y = -0;
//prec = 0.00000000000001;
var x = new Array();
x[0] = -0.000000000000001;
x[2] = -Infinity;
x[1] = -1;
var xnum = 3;
for (var i = 0; i < xnum; i++)
{
if (!isEqual(Math.atan2(y,x[i]), - Math.PI))
$ERROR("#1: Math.abs(Math.atan2(" + y + ", " + x[i] + ") + Math.PI) >= " + prec);
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If y<0 and x is +0, Math.atan2(y,x) is an implementation-dependent
approximation to -PI/2
es5id: 15.8.2.5_A12
description: >
Checking if Math.atan2(y,+0) is an approximation to -PI/2, where
y<0
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var x = +0;
//prec = 0.00000000000001;
var y = new Array();
y[0] = -0.000000000000001;
y[2] = -Infinity;
y[1] = -1;
var ynum = 3;
for (var i = 0; i < ynum; i++)
{
if (!isEqual(Math.atan2(y[i],x), -(Math.PI)/2))
$ERROR("#1: Math.abs(Math.atan2(" + y[i] + ", " + x + ") + ((Math.PI)/2)) >= " + prec);
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If y<0 and x is -0, Math.atan2(y,x) is an implementation-dependent
approximation to -PI/2
es5id: 15.8.2.5_A13
description: >
Checking if Math.atan2(y,-0) is an approximation to -PI/2, where
y<0
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var x = -0;
//prec = 0.00000000000001;
var y = new Array();
y[0] = -0.000000000000001;
y[2] = -Infinity;
y[1] = -1;
var ynum = 3;
for (var i = 0; i < ynum; i++)
{
if (!isEqual(Math.atan2(y[i],x), -(Math.PI)/2))
$ERROR("#1: Math.abs(Math.atan2(" + y[i] + ", -0) + ((Math.PI)/2)) >= " + prec);
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If y>0 and y is finite and x is equal to -Infinity, Math.atan2(y,x) is an
implementation-dependent approximation to +PI
es5id: 15.8.2.5_A15
description: >
Checking if Math.atan2(y,x) is an approximation to +PI, where y>0
and y is finite and x is equal to -Infinity
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var x = -Infinity;
var y = new Array();
y[0] = 0.000000000000001;
y[1] = 1;
y[2] = 1.7976931348623157E308; //largest finite number
var ynum = 3;
for (var i = 0; i < ynum; i++)
{
if (!isEqual(Math.atan2(y[i],x),Math.PI))
$ERROR("#1: Math.abs(Math.atan2(" + y[i] + ", " + x + ") - Math.PI) >= " + prec);
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If y<0 and y is finite and x is equal to -Infinity, Math.atan2(y,x) is an
implementation-dependent approximation to -PI
es5id: 15.8.2.5_A17
description: >
Checking if Math.atan2(y,x) is an approximation to -PI, where y<0
and y is finite and x is equal to -Infinity
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var x = -Infinity;
var y = new Array();
y[0] = -0.000000000000001;
y[1] = -1;
y[2] = -1.7976931348623157E308; //largest (by module) finite number
var ynum = 3;
for (var i = 0; i < ynum; i++)
{
if (!isEqual(Math.atan2(y[i],x), -Math.PI))
$ERROR("#1: Math.abs(Math.atan2(" + y[i] + ", " + x + ") + Math.PI) >= " + prec);
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If y is +Infinity and x is finite, Math.atan2(y,x) is an
implementation-dependent approximation to +PI/2
es5id: 15.8.2.5_A18
description: >
Checking if Math.atan2(y,x) is an approximation to +PI/2, where y
is +Infinity and x is finite
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var y = +Infinity;
var x = new Array();
x[0] = 0.000000000000001;
x[1] = 1;
x[2] = 1.7976931348623157E308; //largest finite number
x[3] = -0.000000000000001;
x[4] = -1;
x[5] = -1.7976931348623157E308; //largest (by module) finite number
var xnum = 6;
for (var i = 0; i < xnum; i++)
{
if (!isEqual(Math.atan2(y,x[i]), (Math.PI)/2))
$ERROR("#1: Math.abs(Math.atan2(" + y + ", " + x[i] + ") - (Math.PI/2)) >= " + prec);
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If y is -Infinity and x is finite, Math.atan2(y,x) is an
implementation-dependent approximation to -PI/2
es5id: 15.8.2.5_A19
description: >
Checking if Math.atan2(y,x) is an approximation to -PI/2, where y
is -Infinity and x is finite
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
//prec = 0.00000000000001;
var y = -Infinity;
var x = new Array();
x[0] = 0.000000000000001;
x[1] = 1;
x[2] = 1.7976931348623157E308; //largest finite number
x[3] = -0.000000000000001;
x[4] = -1;
x[5] = -1.7976931348623157E308; //largest (by module) finite number
var xnum = 6;
for (var i = 0; i < xnum; i++)
{
if (!isEqual(Math.atan2(y,x[i]), -(Math.PI)/2))
$ERROR("#1: Math.abs(Math.atan2(" + y + ", " + x[i] + ") + (Math.PI/2)) >= " + prec);
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If y>0 and x is +0, Math.atan2(y,x) is an implementation-dependent
approximation to +PI/2
es5id: 15.8.2.5_A2
description: >
Checking if Math.atan2(y,x) is an approximation to +PI/2, where
y>0 and x is +0
includes:
- math_precision.js
- math_isequal.js
---*/
// CHECK#1
var x = +0;
//prec = 0.00000000000001;
var y = new Array();
y[0] = 0.000000000000001;
y[2] = +Infinity;
y[1] = 1;
var ynum = 3;
for (var i = 0; i < ynum; i++)
{
if (!isEqual(Math.atan2(y[i],x),(Math.PI)/2))
$ERROR("#1: Math.abs(Math.atan2(" + y[i] + ", " + x + ") - ((Math.PI)/2)) >= " + prec);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment