High cost of failed Math.*Exact calls

Charles Oliver Nutter headius at headius.com
Sat Jan 11 02:48:22 UTC 2025


On Fri, Jan 10, 2025 at 8:31 PM Charles Oliver Nutter <headius at headius.com>
wrote:

> long high = Math.multiplyHigh(value, other);
> long low = value * other;
> if (high == 0 && low >= 0 || value < 0 || high == 0 && other < 0) {
>     return asFixnum(context, low);
> }
>

This pasted weirdly... but it doesn't matter because there's an additional
flaw: it will reject *all* negative results because the high 64 bits will
be non-zero.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250110/029559d3/attachment.htm>


More information about the core-libs-dev mailing list