jdk/src/share/classes/java/math/BigInteger.java
changeset 21956 ec42ad3d0bf8
parent 21420 a56f40ab71ce
child 21983 586d25bfe206
equal deleted inserted replaced
21955:abc02575919c 21956:ec42ad3d0bf8
   213      * The threshold value for using Karatsuba multiplication.  If the number
   213      * The threshold value for using Karatsuba multiplication.  If the number
   214      * of ints in both mag arrays are greater than this number, then
   214      * of ints in both mag arrays are greater than this number, then
   215      * Karatsuba multiplication will be used.   This value is found
   215      * Karatsuba multiplication will be used.   This value is found
   216      * experimentally to work well.
   216      * experimentally to work well.
   217      */
   217      */
   218     private static final int KARATSUBA_THRESHOLD = 50;
   218     private static final int KARATSUBA_THRESHOLD = 80;
   219 
   219 
   220     /**
   220     /**
   221      * The threshold value for using 3-way Toom-Cook multiplication.
   221      * The threshold value for using 3-way Toom-Cook multiplication.
   222      * If the number of ints in each mag array is greater than the
   222      * If the number of ints in each mag array is greater than the
   223      * Karatsuba threshold, and the number of ints in at least one of
   223      * Karatsuba threshold, and the number of ints in at least one of
   224      * the mag arrays is greater than this threshold, then Toom-Cook
   224      * the mag arrays is greater than this threshold, then Toom-Cook
   225      * multiplication will be used.
   225      * multiplication will be used.
   226      */
   226      */
   227     private static final int TOOM_COOK_THRESHOLD = 75;
   227     private static final int TOOM_COOK_THRESHOLD = 240;
   228 
   228 
   229     /**
   229     /**
   230      * The threshold value for using Karatsuba squaring.  If the number
   230      * The threshold value for using Karatsuba squaring.  If the number
   231      * of ints in the number are larger than this value,
   231      * of ints in the number are larger than this value,
   232      * Karatsuba squaring will be used.   This value is found
   232      * Karatsuba squaring will be used.   This value is found
   233      * experimentally to work well.
   233      * experimentally to work well.
   234      */
   234      */
   235     private static final int KARATSUBA_SQUARE_THRESHOLD = 90;
   235     private static final int KARATSUBA_SQUARE_THRESHOLD = 128;
   236 
   236 
   237     /**
   237     /**
   238      * The threshold value for using Toom-Cook squaring.  If the number
   238      * The threshold value for using Toom-Cook squaring.  If the number
   239      * of ints in the number are larger than this value,
   239      * of ints in the number are larger than this value,
   240      * Toom-Cook squaring will be used.   This value is found
   240      * Toom-Cook squaring will be used.   This value is found
   241      * experimentally to work well.
   241      * experimentally to work well.
   242      */
   242      */
   243     private static final int TOOM_COOK_SQUARE_THRESHOLD = 140;
   243     private static final int TOOM_COOK_SQUARE_THRESHOLD = 216;
   244 
   244 
   245     /**
   245     /**
   246      * The threshold value for using Burnikel-Ziegler division.  If the number
   246      * The threshold value for using Burnikel-Ziegler division.  If the number
   247      * of ints in the number are larger than this value,
   247      * of ints in the number are larger than this value,
   248      * Burnikel-Ziegler division will be used.   This value is found
   248      * Burnikel-Ziegler division will be used.   This value is found
   249      * experimentally to work well.
   249      * experimentally to work well.
   250      */
   250      */
   251     static final int BURNIKEL_ZIEGLER_THRESHOLD = 50;
   251     static final int BURNIKEL_ZIEGLER_THRESHOLD = 80;
   252 
   252 
   253     /**
   253     /**
   254      * The threshold value for using Schoenhage recursive base conversion. If
   254      * The threshold value for using Schoenhage recursive base conversion. If
   255      * the number of ints in the number are larger than this value,
   255      * the number of ints in the number are larger than this value,
   256      * the Schoenhage algorithm will be used.  In practice, it appears that the
   256      * the Schoenhage algorithm will be used.  In practice, it appears that the
   257      * Schoenhage routine is faster for any threshold down to 2, and is
   257      * Schoenhage routine is faster for any threshold down to 2, and is
   258      * relatively flat for thresholds between 2-25, so this choice may be
   258      * relatively flat for thresholds between 2-25, so this choice may be
   259      * varied within this range for very small effect.
   259      * varied within this range for very small effect.
   260      */
   260      */
   261     private static final int SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 8;
   261     private static final int SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 20;
   262 
   262 
   263     //Constructors
   263     //Constructors
   264 
   264 
   265     /**
   265     /**
   266      * Translates a byte array containing the two's-complement binary
   266      * Translates a byte array containing the two's-complement binary