BigInt: BigInt(Number.MAX_SAFE_INTEGER) & BigInt(-Number.MAX_SAFE_INTEGER)

This commit is contained in:
Rick Waldron 2017-10-18 17:14:05 -04:00
parent 08a967c8a4
commit a7fbcf3d9a
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
// Copyright (C) 2017 Robin Templeton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Throws a TypeError if BigInt is called with a new target
esid: sec-bigint-constructor
info: |
...
3. If Type(prim) is Number, return ? NumberToBigInt(prim).
...
NumberToBigInt ( number )
2. If IsSafeInteger(number) is false, throw a RangeError exception.
features: [BigInt]
---*/
assert.sameValue(BigInt(Number.MAX_SAFE_INTEGER), 9007199254740991n);
assert.sameValue(BigInt(-Number.MAX_SAFE_INTEGER), -9007199254740991n);