Closed kevaundray closed 1 year ago
It also seems that the non batched version of invert will panic on zero, if I'm understanding correctly:
if (number === _0n || modulo <= _0n) {
throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);
}
Document where?
It's reasonable. It should be undefined or error since inverse doesn't exist.
Right, I'm not commenting on whether it's reasonable, just that it would be good to have it documented, preferably on top of the function?
Though as commented above, batchInvert and Invert seem to have different behaviour on zero, what was the rationale behind this?
Though as commented above, batchInvert and Invert seem to have different behaviour on zero, what was the rationale behind this?
Performance reasons and easier testing
done
The current behavior when a value is 0 in batchInvert is to return undefined for that element. It would be good to document this behavior on top of the batchInvert method.