Review Request: BigInteger patch for efficient multiplication and division (#4837946)

Brian Burkhalter brian.burkhalter at oracle.com
Mon May 13 23:44:29 UTC 2013


On May 13, 2013, at 11:57 AM, Brian Burkhalter wrote:

> On May 11, 2013, at 8:35 PM, Alan Eliasen wrote:
> 
>> On 05/09/2013 03:02 PM, Brian Burkhalter wrote:
>>>> First you have:
>>>> 
>>>>  /**
>>>>   * The threshold value for using 3-way Toom-Cook multiplication.
>>>>   * If the number of ints in both mag arrays are greater than this number,
>>>>   * then Toom-Cook multiplication will be used.   This value is found
>>>>   * experimentally to work well.
>>>>   */
>>>>  private static final int TOOM_COOK_THRESHOLD = 75;
>> 
>>  You're right that the actual code will use Toom-Cook if 1.) both of
>> the numbers are greater than the Karatsuba threshold *and* 2.) at least
>> one of the numbers is greater than the Toom-Cook threshold.
>> […]
>>  If you want to change the comment to something like my first sentence
>> in the first paragraph, that would be fine.  Alternately, we could
>> change the logic to match the comment, but that would probably mean that
>> we should re-tune the thresholds.
> 
> I would prefer simply to change the javadoc of the constant unless others have a strong preference otherwise.

For example:

    /**
     * The threshold value for using 3-way Toom-Cook multiplication.
     * If the number of ints in each mag array is greater than the
     * Karatsuba threshold, and the number of ints in at least one of
     * the mag arrays is greater than this threshold, then Toom-Cook
     * multiplication will be used.
     */
    private static final int TOOM_COOK_THRESHOLD = 75;

Brian


More information about the core-libs-dev mailing list