Skip to content

Commit b9e8f0d

Browse files
🔍 test: Cover edge case of double representation.
1 parent d3e36fb commit b9e8f0d

25 files changed

+6064
-1
lines changed

test/generate.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1+
from math import ceil
2+
from math import sqrt
3+
14
MAX_NUMBER = 2**53 - 1
25
MIN_NUMBER = -2**53
36

7+
LARGEST_BASE = ceil(sqrt(MAX_NUMBER))
8+
LARGEST_LIMB = LARGEST_BASE - 1
9+
10+
print('MAX_NUMBER', MAX_NUMBER)
11+
print('MIN_NUMBER', MIN_NUMBER)
12+
print('LARGEST_BASE', LARGEST_BASE)
13+
print('LARGEST_LIMB', LARGEST_LIMB)
14+
15+
assert(LARGEST_LIMB ** 2 < MAX_NUMBER)
16+
417
hugenumbers = sorted([
18+
LARGEST_LIMB ,
19+
LARGEST_BASE ,
520
91**7 ,
621
2**30 ,
7-
3**50
22+
3**50 ,
823
])
924

1025
smallnumbers = sorted([ 1 , 3 , 7 , 9 , 11 , 17 , 22 , 24 , 27 , 29 , 1234 , 5678 ])

test/src/integer/arithmetic/add.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/addn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/div.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/divmod.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/divmodn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/divn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/iadd.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/iaddn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/idiv.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/idivmod.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/idivmodn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/idivn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/imod.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/imodn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/imul.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/imuln.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/isub.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/isubn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/mod.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/modn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/mul.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/muln.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/sub.js

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.

test/src/integer/arithmetic/subn.js

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)