Skip to content

Commit 803658a

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
[corelib_2] fix bigint_from_test for web platforms
Change-Id: Ib97814ba6b30822296c24026ddcd09f119508ed7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108422 Reviewed-by: Lasse R.H. Nielsen <[email protected]> Commit-Queue: Stephen Adams <[email protected]>
1 parent ad6b1eb commit 803658a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/corelib_2/bigint_from_test.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ main() {
6464
testInt(int n) {
6565
var bigint = new BigInt.from(n);
6666
Expect.equals(n, bigint.toInt());
67+
68+
// If the integers are inexact (e.g. > 2^53 when represented by doubles as
69+
// when compiled to JavaScript numbers) then the 'toString' might be rounded
70+
// to the nearest equivalent 'nicer looking' number.
71+
if (n == n + 1 || n == n - 1) return;
72+
6773
Expect.equals("$n", "$bigint");
6874
}
6975

0 commit comments

Comments
 (0)