Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/BigInt/issafeinteger-true.js

raw
1 // Copyright (C) 2017 Robin Templeton. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: Throws a TypeError if BigInt is called with a new target
6 esid: sec-bigint-constructor
7 info: |
8 ...
9 3. If Type(prim) is Number, return ? NumberToBigInt(prim).
10 ...
11
12 NumberToBigInt ( number )
13
14 2. If IsSafeInteger(number) is false, throw a RangeError exception.
15
16 features: [BigInt]
17 ---*/
18
19 assert.sameValue(BigInt(Number.MAX_SAFE_INTEGER), 9007199254740991n);
20 assert.sameValue(BigInt(-Number.MAX_SAFE_INTEGER), -9007199254740991n);