Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Commit dab221a

Browse files
author
Jakob Olesen
committed
Throw a RangeError when fromFloat32x4 sees a NaN.
This brings the polyfill and tests in line with the text of the specification.
1 parent 13bb258 commit dab221a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎src/ecmascript_simd.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function simdFrom(toType, fromType, a) {
160160
for (var i = 0; i < fromType.lanes; i++) {
161161
var v = fromType.fn.extractLane(a, i);
162162
if (toType.minVal !== undefined &&
163-
(v < toType.minVal || v > toType.maxVal)) {
163+
!(toType.minVal <= v && v <= toType.maxVal)) {
164164
throw new RangeError("Can't convert value");
165165
}
166166
lanes[i] = v;

‎src/ecmascript_simd_tests.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ function testFrom(toType, fromType, name) {
496496
var fromValue = createSplatValue(fromType, v);
497497
v = simdConvert(fromType, v);
498498
if (toType.minVal !== undefined &&
499-
(v < toType.minVal || v > toType.maxVal)) {
499+
!(toType.minVal <= v && v <= toType.maxVal)) {
500500
throws(function() { toType.fn[name](fromValue) });
501501
} else {
502502
v = simdConvert(toType, v);

0 commit comments

Comments
 (0)