Closed diego0020 closed 2 years ago
maybe it is related to integers being 32 bits long, can we use bigintegers for n > 30 ?
It is because c.length = 2250829575120
, which is larger than 0xFFFFFFFF
or maximum Number
that can safely apply bitwise operation. Now that all browsers support BigInt
, I have made .bitwiseIterator()
use BigInt
so it works beyond 0xFFFFFFFF
.
https://github.com/dankogai/js-combinatorics/commit/65cff7cc270e71ac18d9def280c0d8cd18078406
The bitwise iterator is producing strange results in some cases, for example
the
.nth
function produces a correct output of length 35,but the iterator produces only an array of length 3
Apparently it works as expected up to 30, the for 31 and 32 it produces only empty arrays, and for larger numbers it truncates the length of the resulting combinations.
Tested on chrome 91 and firefox 91