harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artem Aliev (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2429) [math] java.math.BigDecimal(-0.0) returns wrong object
Date Mon, 04 Dec 2006 13:25:21 GMT
[math] java.math.BigDecimal(-0.0) returns wrong object
------------------------------------------------------

                 Key: HARMONY-2429
                 URL: http://issues.apache.org/jira/browse/HARMONY-2429
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Artem Aliev


java.math.BigDecimal(-0.0) returns wrong object.
As result Math.pow(10, obj.scale()) returns Infinity while RI returns 1.0.

Test for reproducing:
import junit.framework.TestCase;
import java.math.*;

public class test extends TestCase {     

    public void test1 () {  

       try {  
           double val=-0.0; 
           BigDecimal obj = new BigDecimal(val);

           System.out.println("BigDecimal(-0.0)"+ obj);
           System.out.println( "scale="+obj.scale());
           System.out.println( Math.pow(10, obj.scale()));

       } catch (Exception e) {
           e.printStackTrace();
       } 
    }

}
Output on Sun 1.5
=================
.BigDecimal(-0.0)0
scale=0
1.0
Time: 0,015

OK (1 test)

Output on Harmony:
==================
.BigDecimal(-0.0)0E-1011
scale=1011
Infinity

Time: 0.031

OK (1 test)


-- 
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