BigInteger.squareToLen() can be wrong (when called directly)

Brian Burkhalter brian.burkhalter at oracle.com
Thu May 14 16:01:51 UTC 2020


Hi Jeff,

I filed https://bugs.openjdk.java.net/browse/JDK-8245038 to track this.

Thanks,

Brian

> On May 11, 2020, at 7:33 AM, Jeff Hain <jeffhainrocket at gmail.com> wrote:
> 
> While trying to use BigInteger.squareToLen(x, len, z) directly
> (with reflection), I saw that its pure Java implementation
> computed wrong results when a 'z' is specified with
> (z.length > 2 * len).
> Ex.:
> x = {1, 2}
> len = 2
> with z.length = 4: {0, 1, 4, 4} (as expected)
> with z.length = 5: {0, 1, 0, 8, 0} instead of {0, 1, 4, 4, 0}



More information about the core-libs-dev mailing list