Commit afd4910a by Jerry Quinn Committed by Tom Tromey

BigInteger.java (probablePrime): New.

2003-04-19  Jerry Quinn  <jlquinn@optonline.net>

	* java/math/BigInteger.java (probablePrime): New.
	* java/math/BigDecimal.java (unscaledValue): New.

From-SVN: r65825
parent f1a1591b
2003-04-19 Jerry Quinn <jlquinn@optonline.net>
* java/math/BigInteger.java (probablePrime): New.
* java/math/BigDecimal.java (unscaledValue): New.
2003-04-19 Ranjit Mathew <rmathew@hotmail.com>
* java/io/File.java (getAbsolutePath): On Windows, take care
......
......@@ -431,6 +431,11 @@ public class BigDecimal extends Number implements Comparable
return scale;
}
public BigInteger unscaledValue()
{
return intVal;
}
public BigDecimal abs ()
{
return new BigDecimal (intVal.abs (), scale);
......
......@@ -223,6 +223,23 @@ public class BigInteger extends Number implements Comparable
}
}
/**
* Return a BigInteger that is bitLength bits long with a
* probability < 2^-100 of being composite.
*
* @param bitLength length in bits of resulting number
* @param rnd random number generator to use
* @throws ArithmeticException if bitLength < 2
* @since 1.4
*/
public static BigInteger probablePrime(int bitLength, Random rnd)
{
if (bitLength < 2)
throw new ArithmeticException();
return new BigInteger(bitLength, 100, rnd);
}
/** Return a (possibly-shared) BigInteger with a given long value. */
public static BigInteger valueOf(long val)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment