harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "tatyana doubtsova (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1996) BigInteger bitwise operations work incorrectly for negative values
Date Sun, 29 Oct 2006 14:24:17 GMT
BigInteger bitwise operations work incorrectly for negative values
------------------------------------------------------------------

                 Key: HARMONY-1996
                 URL: http://issues.apache.org/jira/browse/HARMONY-1996
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: tatyana doubtsova


It seems that after applying patch for http://issues.apache.org/jira/browse/HARMONY-1636
BigInteger bitwise operations work incorrectly.

Code for reproducing:
import java.math.*;

public class Test2 {
	
    public static void main(String[] args) {
    BigInteger x = new BigInteger("-1023");
    
    BigInteger r1 =  x.and((BigInteger.ZERO.not()).shiftLeft(32));
    BigInteger r3 =  x.and((BigInteger.ZERO.not().shiftLeft(32) ).not());
    
    System.out.println("r1 = " + r1);
    System.out.println("r3 = " + r3);
            
    BigInteger result = r1.or(r3);
    System.out.println("result = " + result);
    }    
}

===================
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0" 
pre-alpha : not complete or compatible
svn = r468686, (Oct 29 2006), Linux/ia32/gcc 3.3.3, release build
http://incubator.apache.org/harmony
r1 = -4294967296
r3 = 4294966273
result = -4294968319
 
Output on SUN jdk
===================
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode)
 
r1 = -4294967296
r3 = 4294966273
result = -1023

If I roll back http://issues.apache.org/jira/browse/HARMONY-1636, bitwise operations work
correctly.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message