Skip to content

Commit 0620cfd

Browse files
author
Brian Hulette
committed
use Math.fround
1 parent 0126dc4 commit 0620cfd

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

js/test/unit/table-tests.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ describe(`Table`, () => {
118118
// Wrap floating point values in a Float32Array and take them back out to
119119
// make sure that equality checks will pass
120120
const values = [
121-
[new Float32Array([-0.3])[0], -1, 'a'],
122-
[new Float32Array([-0.2])[0], 1, 'b'],
123-
[new Float32Array([-0.1])[0], -1, 'c'],
124-
[new Float32Array([ 0 ])[0], 1, 'a'],
125-
[new Float32Array([ 0.1])[0], -1, 'b'],
126-
[new Float32Array([ 0.2])[0], 1, 'c'],
127-
[new Float32Array([ 0.3])[0], -1, 'a']
121+
[Math.fround(-0.3), -1, 'a'],
122+
[Math.fround(-0.2), 1, 'b'],
123+
[Math.fround(-0.1), -1, 'c'],
124+
[Math.fround( 0 ), 1, 'a'],
125+
[Math.fround( 0.1), -1, 'b'],
126+
[Math.fround( 0.2), 1, 'c'],
127+
[Math.fround( 0.3), -1, 'a']
128128
];
129129
test(`has the correct length`, () => {
130130
expect(table.length).toEqual(values.length);
@@ -321,15 +321,15 @@ describe(`Table`, () => {
321321
// Wrap floating point values in a Float32Array and take them back out to
322322
// make sure that equality checks will pass
323323
const values = [
324-
[new Float32Array([-0.3])[0], -1, 'a'],
325-
[new Float32Array([-0.2])[0], 1, 'b'],
326-
[new Float32Array([-0.1])[0], -1, 'c'],
327-
[new Float32Array([ 0 ])[0], 1, 'a'],
328-
[new Float32Array([ 0.1])[0], -1, 'b'],
329-
[new Float32Array([ 0.2])[0], 1, 'c'],
330-
[new Float32Array([ 0.3])[0], -1, 'a'],
331-
[new Float32Array([ 0.2])[0], 1, 'b'],
332-
[new Float32Array([ 0.1])[0], -1, 'c'],
324+
[Math.fround(-0.3), -1, 'a'],
325+
[Math.fround(-0.2), 1, 'b'],
326+
[Math.fround(-0.1), -1, 'c'],
327+
[Math.fround( 0 ), 1, 'a'],
328+
[Math.fround( 0.1), -1, 'b'],
329+
[Math.fround( 0.2), 1, 'c'],
330+
[Math.fround( 0.3), -1, 'a'],
331+
[Math.fround( 0.2), 1, 'b'],
332+
[Math.fround( 0.1), -1, 'c'],
333333
];
334334
test(`has the correct length`, () => {
335335
expect(table.length).toEqual(values.length);

0 commit comments

Comments
 (0)