same-value-x-y-number.js (836B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 19.1.2.10 5 description: > 6 Object.is ( value1, value2 ) 7 8 ... 9 6. If Type(x) is Number, then 10 a. If x is NaN and y is NaN, return true. 11 b. If x is +0 and y is -0, return false. 12 c. If x is -0 and y is +0, return false. 13 d. If x is the same Number value as y, return true. 14 e. Return false. 15 ... 16 ---*/ 17 18 assert.sameValue(Object.is(NaN, NaN), true, "`Object.is(NaN, NaN)` returns `true`"); 19 assert.sameValue(Object.is(-0, -0), true, "`Object.is(-0, -0)` returns `true`"); 20 assert.sameValue(Object.is(+0, +0), true, "`Object.is(+0, +0)` returns `true`"); 21 assert.sameValue(Object.is(0, 0), true, "`Object.is(0, 0)` returns `true`"); 22 23 reportCompare(0, 0);