25 Commits

Author SHA1 Message Date
Brian Burkhalter
7e0de8f634 8035279: Clean up internal deprecations in BigInteger
Rename pertinent private instance variables to describe what they actually represent.

Reviewed-by: psandoz, smarks
2014-03-07 12:40:37 -08:00
Brian Burkhalter
997e4bbc8b 4891331: BigInteger a.multiply(a) should use squaring code
Change multiply(BigInteger a) to return square() if a == this and the number of ints in the magnitude is over a threshold.

Reviewed-by: darcy, shade
2013-12-13 16:15:58 -08:00
Brian Burkhalter
efe4e2425f 8029501: BigInteger division algorithm selection heuristic is incorrect
Change Burnikel-Ziegler division heuristic to require that the dividend int-length exceed that of the divisor by a minimum amount.

Reviewed-by: darcy
2013-12-05 07:45:27 -08:00
Brian Burkhalter
9fab2b1e9a 8029514: java/math/BigInteger/BigIntegerTest.java failing since thresholds adjusted in 8022181
Ensure the value returned by getLower() is unsigned.

Reviewed-by: darcy
2013-12-05 07:44:59 -08:00
Brian Burkhalter
6c3fdefd1d 8022181: Tune algorithm crossover thresholds in BigInteger
Change multiplication, squaring, division, and base conversion thresholds to values which retain performance improvement in most cases but with a a lower overall risk of regression.

Reviewed-by: darcy
2013-12-03 12:25:32 -08:00
Dmitry Nadezhin
9e7ba92bff 6910473: java.math.BigInteger.bitLength() may return negative "int" on large numbers
8021203: BigInteger.doubleValue/floatValue returns 0.0 instead of Infinity
8021204: Constructor BigInteger(String val, int radix) doesn't detect overflow
8022780: Incorrect BigInteger division because of MutableBigInteger.bitLength() overflow

Prevent construction of overflowed BigIntegers.

Reviewed-by: bpb, darcy, psandoz
2013-10-30 17:45:12 -07:00
Brian Burkhalter
3b56462097 7189139: BigInteger's staticRandom field can be a source of bottlenecks
Use ThreadLocalRandom instead of SecureRandom.

Reviewed-by: shade, psandoz
2013-10-09 17:22:34 -07:00
Brian Burkhalter
6c5c2d745a 6378503: In java.math.BigDecimal, division by one returns zero
6446965: Using BigDecimal.divideToIntegralValue with extreme scales can lead to an incorrect result

Fix overflow of ints and ensure appropriate values passed to checkScaleNonZero()

Reviewed-by: darcy, martin
2013-08-23 14:15:54 -07:00
Brian Burkhalter
4fe69c432f 8020641: Clean up some code style in recent BigInteger contributions
Some minor cleanup to adhere better to Java coding conventions.

Reviewed-by: darcy
2013-07-26 17:09:30 -07:00
Tim Buktu
d59c1fac00 8014319: Faster division of large integers
Implement Burnickel-Ziegler division algorithm in BigInteger

Reviewed-by: bpb, martin
2013-07-26 17:03:19 -07:00
Peter Levart
329abc4028 8017540: Improve multi-threaded contention behavior of radix conversion cache
Replace array of ArrayList of BigIntegers with a volatile two-dimensional BigInteger array eliminate the synchronization of getRadixConversionCache()

Co-authored-by: Dmitry Nadezhin <dmitry.nadezhin@oracle.com>
Co-authored-by: Aleksey Shipilev <aleksey.shipilev@oracle.com>
Reviewed-by: plevart, shade, bpb, alanb
2013-07-01 11:30:14 -07:00
Alan Eliasen
5a0793018c 4641897: Faster string conversion of large integers
Accelerate conversion to string by means of Schoenhage recursive base conversion.

Reviewed-by: bpb, alanb
2013-06-20 12:15:24 -07:00
Louis Wasserman
90aebf1cf9 7131192: BigInteger.doubleValue() is depressingly slow
In doubleValue() and floatValue() replace converting to String and parsing to Double or Float with direct conversion into IEEE 754 bits.

Reviewed-by: bpb, drchase, martin
2013-06-21 11:50:45 -07:00
Alan Eliasen
3a76795991 4837946: Faster multiplication and exponentiation of large integers
4646474: BigInteger.pow() algorithm slow in 1.4.0

Implement Karatsuba and 3-way Toom-Cook multiplication as well as exponentiation using Karatsuba and Toom-Cook squaring.

Reviewed-by: alanb, bpb, martin
2013-06-19 08:59:39 -07:00
Joe Darcy
30d2b45bd8 6879143: java.math.BigInteger misses the xxxValueExact methods
Reviewed-by: alanb
2011-09-14 11:32:11 -07:00
Joe Darcy
2a22d4691a 6838776: Defer initialization of static fields in java.math.BigInteger
Reviewed-by: mduigou, mduigou
2011-09-06 06:17:52 -07:00
Joe Darcy
3d9f3ee2b1 6989067: BigInteger's array copiers should be converted to System.arraycopy()
Reviewed-by: mduigou, forax
2011-09-02 16:06:08 -07:00
Sergey Kuksenko
238bb5d3bb 7082971: More performance tuning of BigDecimal and other java.math classes
Reviewed-by: darcy
2011-09-01 23:00:09 -07:00
Jim Holmlund
bbf16c0b3a 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
7032965: API files in java.io need to updated for references to JVM Spec with editions/hyperlinks
7032958: API files in java.lang need to updated for references to JLS with editions/hyperlinks
7032961: API files in java.lang need to updated for references to JVM with editions/hyperlinks
7032976: API files in javax.lang need to be updated for references to JLS with editions/hyperlinks
7032959: API files in java.util need to updated for references to JLS with editions/hyperlinks
7032962: API files in java.util need to updated for references to JVM Spec with editions/hyperlinks
7032967: API files in java.security need to updated for references to JVM Spec with editions/hyperlinks
7032955: API files in java.math need to updated for references to JLS with editions/hyperlinks

Removed URLs and 'edition' references

Reviewed-by: darcy
2011-04-13 12:16:13 -07:00
Kelly O'Hair
fe008ae27a 6943119: Rebrand source copyright notices
Reviewed-by: darcy, weijun
2010-05-25 15:58:33 -07:00
Joe Darcy
3e515ef90f 6897550: BigInteger constructor should use local cached String length
Reviewed-by: andrew, chegar
2009-11-03 15:01:50 -08:00
Joe Darcy
8c93a06ddd 6560935: BigInteger.modPow() throws ArithmeticException for negative exponent
Reviewed-by: alanb
2009-10-21 09:53:23 -07:00
Joe Darcy
589f5d20cb 6371401: java.math.BigInteger.shift(Integer.MIN_VALUE) throws StackOverflowError
Reviewed-by: alanb
2009-10-20 09:51:28 -07:00
Xiaobin Lu
9f9d70b270 6622432: RFE: Performance improvements to java.math.BigDecimal
Reviewed-by: darcy
2009-05-24 16:29:57 -07:00
J. Duke
319a3b9947 Initial load 2007-12-01 00:00:00 +00:00