Skip to content

Commit a1fbd31

Browse files
ljharbrwaldron
authored andcommitted
Atomics.store now normalizes -0 to +0
Per tc39/ecma262#1827
1 parent 900855b commit a1fbd31

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (C) 2020 Jordan Harband. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-atomics.store
6+
description: >
7+
Atomics.store calls ToInteger, which normalizes -0 to +0
8+
features: [Atomics, SharedArrayBuffer, TypedArray]
9+
---*/
10+
11+
const i32a = new Int32Array(
12+
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
13+
);
14+
15+
assert.ok(
16+
Object.is(
17+
Atomics.store(i32a, 0, -0),
18+
+0
19+
),
20+
'Atomics.store(i32a, 0, -0) normalizes -0 to +0'
21+
);
22+
assert.sameValue(
23+
i32a[0],
24+
+0,
25+
'The value of i32a[0] is normalized to +0'
26+
);

0 commit comments

Comments
 (0)