sign-specialVals.js (714B)
1 // Copyright 2015 Microsoft Corporation. All rights reserved. 2 // This code is governed by the license found in the LICENSE file. 3 4 /*--- 5 description: > 6 Returns the sign of the x, indicating whether x is positive, negative or zero. 7 es6id: 20.2.2.29 8 ---*/ 9 10 assert.sameValue(Math.sign(NaN), NaN, "NaN"); 11 assert.sameValue(Math.sign(-0), -0, "-0"); 12 assert.sameValue(Math.sign(0), 0, "0"); 13 14 assert.sameValue(Math.sign(-0.000001), -1, "-0.000001"); 15 assert.sameValue(Math.sign(-1), -1, "-1"); 16 assert.sameValue(Math.sign(-Infinity), -1, "-Infinity"); 17 18 assert.sameValue(Math.sign(0.000001), 1, "0.000001"); 19 assert.sameValue(Math.sign(1), 1, "1"); 20 assert.sameValue(Math.sign(Infinity), 1, "Infinity"); 21 22 reportCompare(0, 0);