Debian Codegraph @

js/src/tests/test262/built-ins/isNaN/return-false-not-nan-numbers.js

raw
1 // Copyright (C) 2016 The V8 Project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-isnan-number
6 description: >
7 Return false if number is not NaN
8 info: |
9 isNaN (number)
10
11 1. Let num be ? ToNumber(number).
12 2. If num is NaN, return true.
13 3. Otherwise, return false.
14 ---*/
15
16 assert.sameValue(isNaN(0), false, "0");
17 assert.sameValue(isNaN(-0), false, "-0");
18 assert.sameValue(isNaN(Math.pow(2, 53)), false, "Math.pow(2, 53)");
19 assert.sameValue(isNaN(-Math.pow(2, 53)), false, "-Math.pow(2, 53)");
20 assert.sameValue(isNaN(1), false, "1");
21 assert.sameValue(isNaN(-1), false, "-1");
22 assert.sameValue(isNaN(0.000001), false, "0.000001");
23 assert.sameValue(isNaN(-0.000001), false, "-0.000001");
24 assert.sameValue(isNaN(1e42), false, "1e42");
25 assert.sameValue(isNaN(-1e42), false, "-1e42");
26 assert.sameValue(isNaN(Infinity), false, "Infinity");
27 assert.sameValue(isNaN(-Infinity), false, "-Infinity");
28
29 reportCompare(0, 0);