BigInt imul?
js-choi opened this issue · comments
I know of no use case for imul
accepting BigInts, but at least its mathematical behavior would be well defined and exact.
On the other hand, making imul
polymorphic could make optimization for asm.js more difficult. See also the original BigInt proposal’s “Don’t break asm.js” section.
@ljharb has said—and I agree—that that BigInts and Numbers should always be interchangeable by default, unless that would cause silent precision loss – i.e., unless there's a strong reason they should not be (#8 (comment)).
Under this framework, it’d be good to know if a polymorphic imul
would worsen asm.js optimization, which would count as a “strong reason [BigInts and Numbers] should not be [interchangeable]”. CC: @syg, @codehag.
While it'd be good to know regardless, I was under the impression that asm.js was no longer a priority in favor of WASM.
For BigInts, Math.imul
would be a mystification of *
, so I see no reason to support it.
I don't really agree with argument that BigInts and Numbers should be interchangeable by default. Why should they be interchangeable by default? Floating point and arbitrary precision ints are drastically different and choice of which to use should be thought through by the programmer. We can't have even most of Math
work for BigInts, even if you would like them to be interchangeable by default, that intuition just won't hold up in practice, so why push for it?
Closing. There are no known use cases for BigInt imul
, and it may interfere with asm.js.
See also #13 (comment) and #14 (comment).