You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "tatyana doubtsova (JIRA)" <ji...@apache.org> on 2006/10/29 15:24:17 UTC

[jira] Created: (HARMONY-1996) BigInteger bitwise operations work incorrectly for negative values

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

        

[jira] Updated: (HARMONY-1996) [classlib][math]BigInteger bitwise operations work incorrectly for negative values

Posted by "Daniel Fridlender (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1996?page=all ]

Daniel Fridlender updated HARMONY-1996:
---------------------------------------

    Attachment: orPatch.diff

The patch should fix the reported bug.

> [classlib][math]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
>         Attachments: orPatch.diff
>
>
> 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

        

[jira] Updated: (HARMONY-1996) [classlib][math]BigInteger bitwise operations work incorrectly for negative values

Posted by "tatyana doubtsova (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1996?page=all ]

tatyana doubtsova updated HARMONY-1996:
---------------------------------------

    Summary: [classlib][math]BigInteger bitwise operations work incorrectly for negative values  (was: BigInteger bitwise operations work incorrectly for negative values)

> [classlib][math]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

        

[jira] Closed: (HARMONY-1996) [classlib][math]BigInteger bitwise operations work incorrectly for negative values

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1996?page=all ]

Tim Ellison closed HARMONY-1996.
--------------------------------


Verified by Daniel.


> [classlib][math]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
>         Assigned To: Tim Ellison
>         Attachments: orPatch.diff
>
>
> 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

        

[jira] Resolved: (HARMONY-1996) [classlib][math]BigInteger bitwise operations work incorrectly for negative values

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1996?page=all ]

Tim Ellison resolved HARMONY-1996.
----------------------------------

    Resolution: Fixed

Thanks Tatyana & Daniel,

Patch applied to MATH module at repo revision r470833.

Please check that it was applied as you expected.



> [classlib][math]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
>         Assigned To: Tim Ellison
>         Attachments: orPatch.diff
>
>
> 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

        

[jira] Commented: (HARMONY-1996) [classlib][math]BigInteger bitwise operations work incorrectly for negative values

Posted by "Daniel Fridlender (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1996?page=comments#action_12447013 ] 
            
Daniel Fridlender commented on HARMONY-1996:
--------------------------------------------

The patch was applied as expected, thanks!

> [classlib][math]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
>         Assigned To: Tim Ellison
>         Attachments: orPatch.diff
>
>
> 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

        

[jira] Assigned: (HARMONY-1996) [classlib][math]BigInteger bitwise operations work incorrectly for negative values

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1996?page=all ]

Tim Ellison reassigned HARMONY-1996:
------------------------------------

    Assignee: Tim Ellison

> [classlib][math]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
>         Assigned To: Tim Ellison
>         Attachments: orPatch.diff
>
>
> 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