| 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: BigInt division of complex infinity (1/0) |
| 6 |
esid: sec-multiplicative-operators-runtime-semantics-evaluation |
| 7 |
info: | |
| 8 |
Runtime Semantics: Evaluation |
| 9 |
|
| 10 |
MultiplicativeExpression: MultiplicativeExpression MultiplicativeOperator ExponentiationExpression |
| 11 |
|
| 12 |
... |
| 13 |
11. If MultiplicativeOperator is /, return T::divide(lnum, rnum). |
| 14 |
... |
| 15 |
|
| 16 |
BigInt::divide (x, y) |
| 17 |
|
| 18 |
1. If y is 0n, throw a RangeError exception. |
| 19 |
... |
| 20 |
features: [BigInt] |
| 21 |
---*/ |
| 22 |
|
| 23 |
assert.throws(RangeError, function() { |
| 24 |
1n / 0n |
| 25 |
}); |
| 26 |
|
| 27 |
assert.throws(RangeError, function() { |
| 28 |
10n / 0n |
| 29 |
}); |
| 30 |
|
| 31 |
assert.throws(RangeError, function() { |
| 32 |
0n / 0n |
| 33 |
}); |
| 34 |
|
| 35 |
assert.throws(RangeError, function() { |
| 36 |
1000000000000000000n / 0n |
| 37 |
}); |