[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/33206] New: Long overflow in BigInteger.java
From: |
johnx at dodgit dot com |
Subject: |
[Bug classpath/33206] New: Long overflow in BigInteger.java |
Date: |
27 Aug 2007 17:57:07 -0000 |
Bug.java:
---
import java.math.BigInteger;
class Bug {
public static void main(String[] args) {
BigInteger test = new
BigInteger("340282366920938463463374607431768211457");
System.out.println(test.isProbablePrime(80));
}
}
---
Problem:
BigInteger.java:1316:
BigInteger m = pMinus1.divide(valueOf(2L << b - 1));
But b = 128, so 2 << 127 does not fit in a long.
Solution:
BigInteger m = pMinus1.divide(new BigInteger("2").pow(b - 1));
--
Summary: Long overflow in BigInteger.java
Product: classpath
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: johnx at dodgit dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33206
- [Bug classpath/33206] New: Long overflow in BigInteger.java,
johnx at dodgit dot com <=