Bug 1153602 - SIMD (interpreter): Added more test cases for ReciprocalSqrtApproximation. r=Waldo

This commit is contained in:
ProgramFOX 2015-04-29 16:56:53 +02:00
parent 64bf8520c3
commit 3e469a89a7
2 changed files with 7 additions and 3 deletions

View File

@ -52,7 +52,8 @@ function test() {
for ([v, w] of [[float64x2(1, 2), float64x2(3, 4)],
[float64x2(1.894, 2.8909), float64x2(100.764, 200.987)],
[float64x2(-1, -2), float64x2(-14.54, 57)],
[float64x2(+Infinity, -Infinity), float64x2(NaN, -0)]])
[float64x2(+Infinity, -Infinity), float64x2(NaN, -0)],
[float64x2(Math.pow(2, 31), Math.pow(2, -31)), float64x2(Math.pow(2, -1047), Math.pow(2, -149))]])
{
testAdd(v, w);
testSub(v, w);

View File

@ -51,13 +51,16 @@ function testFloat32x4reciprocalApproximation() {
function testFloat32x4reciprocalSqrtApproximation() {
function reciprocalsqrtf(a) {
return Math.fround(1 / Math.sqrt(a));
assertEq(Math.fround(a), a);
return Math.fround(1 / Math.fround(Math.sqrt(a)));
}
var vals = [
[[1, 1, 0.25, 0.25], [1, 1, 2, 2]],
[[25, 16, 6.25, 1.5625], [25, 16, 6.25, 1.5625].map(reciprocalsqrtf)],
[[NaN, -0, Infinity, -Infinity], [NaN, -0, Infinity, -Infinity].map(reciprocalsqrtf)]
[[NaN, -0, Infinity, -Infinity], [NaN, -0, Infinity, -Infinity].map(reciprocalsqrtf)],
[[Math.pow(2, 32), Math.pow(2, -32), +0, Math.pow(2, -148)],
[Math.pow(2, -16), Math.pow(2, 16), Infinity, Math.pow(2, 74)]]
];
for (var [v,w] of vals) {