Commit Graph

45 Commits

Author SHA1 Message Date
Brian Burkhalter
e5a6f24f64 8032027: Add BigInteger square root methods
Add sqrt() and sqrtAndReminder() using Newton iteration

Reviewed-by: darcy, lowasser
2015-12-10 17:47:26 -08:00
Brian Burkhalter
6d59eaa98c 8042983: test/java/math/BigInteger/ExtremeShiftingTests.java needs too much heap
Use @requires tag to suppress the test on limited memory systems.

Reviewed-by: darcy
2015-06-29 14:49:47 -07:00
Chris Hegarty
008fee0591 8079782: RandomFactory should be in the jdk.testlibrary package
Reviewed-by: bpb
2015-05-08 11:02:33 +01:00
Brian Burkhalter
30e8183ee8 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests
Add ability to initial the random number generator from the system property "seed" and print to STDOUT the seed value actually used.

Reviewed-by: darcy
2015-04-29 16:34:49 -07:00
Joe Darcy
86c109e149 8078334: Mark regression tests using randomness
Reviewed-by: xuelei, alanb
2015-04-29 10:25:53 -07:00
Brian Burkhalter
f9a9e68c05 8074460: Always print seeds used in [Splittable]Random instances in java.math tests
Create a utility class which creates a pseudorandom number generator (PRNG) and retains the seed. Use this class in java.math tests which use a PRNG. Always print the seed value before the PRNG is used.

Reviewed-by: darcy
2015-03-06 16:00:58 -08:00
Brian Burkhalter
14b8722c45 8066842: java.math.BigDecimal.divide(BigDecimal, RoundingMode) produces incorrect result
Replace divWord() with non-truncating alternatives

Reviewed-by: psandoz, darcy
2015-02-11 17:20:39 -08:00
Brian Burkhalter
4417397e26 4026465: Provide more byte array constructors for BigInteger
Add two's complement and sign-magnitude constructors for byte arrays with offset and length.

Reviewed-by: darcy, alanb, scolebourne
2015-01-09 17:27:28 -08:00
Brian Burkhalter
6d148f368d 8058679: More bad characters in BigIntegerTest
Remove remaining non-US-ASCII characters

Reviewed-by: alanb
2014-09-17 14:11:40 -07:00
Brian Burkhalter
0c71a5e8f4 8058664: Bad fonts in BigIntegerTest
Replace bad fonts with spaces.

Reviewed-by: alanb
2014-09-17 11:04:16 -07:00
Robert Gibson
8acf66df11 8058505: BigIntegerTest does not exercise Burnikel-Ziegler division
Modify divideLarge() method such that the w/z division exercises the B-Z branch.

Reviewed-by: darcy
2014-09-15 13:25:08 -07:00
Robert Gibson
f5de6e9460 8057793: BigDecimal is no longer effectively immutable
Modify MutableBigInteger.divideAndRemainderBurnikelZiegler() to copy the instance (this) to a new MutableBigInteger to use as the dividend.

Reviewed-by: darcy
2014-09-15 13:05:04 -07:00
Brian Burkhalter
b84fa9d0f7 8042478: Include Mersenne primes in BigInteger primality testing
Add testing of some of the Mersenne primes.

Reviewed-by: darcy
2014-05-08 16:06:43 -07:00
Brian Burkhalter
b89a5598d4 8026236: Add PrimeTest for BigInteger
Test primality verification methods in BigInteger

Co-authored-by: Peter Levart <peter.levart@gmail.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Co-authored-by: Aleksey Shipilev <aleksey.shipilev@oracle.com>
Co-authored-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: psandoz
2014-05-07 11:45:31 -07:00
Brian Burkhalter
0f8476eff8 8041683: Catch OutOfMemoryError in BitLengthOverflow and DoubleValueOverflow
Java/math/BigInteger/BitLengthOverflow.java failing with OOME

Reviewed-by: alanb
2014-04-29 09:42:16 -07:00
Brian Burkhalter
f707a2fd5a 8027595: Enable BigInteger overflow tests in JTREG
Remove space in @test tags, remove OOME catches, add @run tag for StringConstructorOverflow.

Reviewed-by: mduigou
2014-04-18 14:03:46 -07:00
Lana Steuck
657b9db1ba 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
Updated files with 2011, 2012 and 2013 years according to the file's last updated date

Reviewed-by: tbell, lancea, chegar
2013-12-26 12:04:16 -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
8c97f82aae 8027625: test/java/math/BigInteger/ExtremeShiftingTests.java needs @run tag to specify heap size
Add @run tag to specify heap size

Reviewed-by: alanb, dxu
2013-11-04 08:05:02 -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
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
Timothy Buktu
e3b61c033b 8022180: BigInteger Burnikel-Ziegler quotient and remainder calculation assumes quotient parameter is zero
Clear the quotient in divideAndRemainderBurnikelZiegler() if the divisor is larger than the dividend.

Reviewed-by: alanb, bpb
2013-08-12 16:21:10 -07:00
Brian Burkhalter
aafacb6fa6 8022094: BigDecimal/CompareToTests and BigInteger/CompareToTests are incorrect
Fail test if errors; fix test values; port BigDecimal version to BigInteger

Reviewed-by: smarks, alanb
2013-08-02 11:10:41 -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
Brian Burkhalter
9123d3fed3 6480539: BigDecimal.stripTrailingZeros() has no effect on zero itself ("0.0")
Make stripTrailingZeros() return BigDecimal.ZERO if the BigDecimal is numerically equal to zero.

Reviewed-by: darcy
2013-07-09 12:47:37 -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
David Katleman
306cab1006 8004982: JDK8 source with GPL header errors
Reviewed-by: ohair
2012-12-20 16:24:50 -08:00
Joe Darcy
30d2b45bd8 6879143: java.math.BigInteger misses the xxxValueExact methods
Reviewed-by: alanb
2011-09-14 11:32:11 -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
Lana Steuck
b99716e22a Merge 2011-04-17 16:19:29 -07:00
Sergey Kuksenko
c930bfc387 7036582: Improve test coverage of java.math.BigDecimal
Reviewed-by: darcy
2011-04-17 13:49:33 +01:00
Kelly O'Hair
d2b1e20c7d 7033660: Update copyright year to 2011 on any files changed in 2011
Reviewed-by: dholmes
2011-04-06 22:06:11 -07:00
Stuart Marks
dd0e38d73a 7021209: convert lang, math, util to use try-with-resources
Reviewed-by: alanb, darcy, naoto
2011-02-22 15:34:17 -08:00
Kelly O'Hair
fe008ae27a 6943119: Rebrand source copyright notices
Reviewed-by: darcy, weijun
2010-05-25 15:58:33 -07:00
Joe Darcy
b4b4646850 6908541: Bad resource management in java/math/BigInteger/BigIntegerTest.java
Reviewed-by: alanb
2009-12-22 21:48:19 -08:00
Joe Darcy
c40412f4f4 6907177: Update jdk tests to remove unncessary -source and -target options
Reviewed-by: ohair
2009-12-03 18:19:10 -08: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
4b58ee1a37 6876282: BigDecimal's divide(BigDecimal bd, RoundingFormat r) produces incorrect result
Reviewed-by: darcy
2009-08-27 18:00:16 -07:00
Xiaobin Lu
c0146a5bd0 6850606: Regression from JDK 1.6.0_12
The returned result from multiply should be constructed by using valueOf to take care of the INFLATED case.

Reviewed-by: darcy
2009-06-20 13:34:06 -07:00
Xiaobin Lu
2af45eb571 6806261: BigDecimal.longValueExact() method throws NullPointerException
Add various tests to test the change to 6622432

Reviewed-by: darcy
2009-05-24 16:35:32 -07:00
Xiaobin Lu
9f9d70b270 6622432: RFE: Performance improvements to java.math.BigDecimal
Reviewed-by: darcy
2009-05-24 16:29:57 -07:00
Joe Darcy
61f89b0025 6601457: Move wrapper class tests from closed to open
6601458: Move java.math tests from closed to open
6740185: Move java/lang/annotations tests to open
6759433: Move Math and StrictMath regression tests from closed to open

Move some more regression tests to the open

Reviewed-by: jjg
2009-01-26 19:49:26 -08:00