mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00:00
LibJS: Throw RangeError on BigInt exponentiation with negative exponent
https://tc39.es/ecma262/#sec-numeric-types-bigint-exponentiate
This commit is contained in:
parent
11138f5c1f
commit
fa6bce5087
3 changed files with 13 additions and 1 deletions
|
@ -96,4 +96,10 @@ describe("errors", () => {
|
|||
1n % 0n;
|
||||
}).toThrowWithMessage(RangeError, "Division by zero");
|
||||
});
|
||||
|
||||
test("negative exponent", () => {
|
||||
expect(() => {
|
||||
1n ** -1n;
|
||||
}).toThrowWithMessage(RangeError, "Exponent must be positive");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue