bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/39743] New: BigDecimal fails on lots of tests


From: guich at superwaba dot com dot br
Subject: [Bug classpath/39743] New: BigDecimal fails on lots of tests
Date: 12 Apr 2009 11:57:38 -0000

Hi,

I found a test suite for BigDecimal on Internet and adapted it to run with
classpath's BigDecimal. First i ran the tests over Java's BigDecimal, removed
all tests that failed. Then i used BigDecimal from version 0.98. Several tests
had failed. I made some fixes, which i describe below, but most are broken.

First, my fixes:

   public BigInteger(String s, int radix) 
...
      char ch = len == 0 ? 0 : s.charAt(0); // guich: test if len is 0

   public BigDecimal(String num) 

replace:
   scale -= Convert.toInt(num.substring(point));

by:

            if (dot >= 0) // guich: no dot, have to add, not sub
               scale -= Convert.toInt(num.substring(point));
            else
               scale += Convert.toInt(num.substring(point));

public String toString()

replace:
          if (point - 1 >= 0) 
             val.append('+'); 
          val.append(point - 1);

to
        // guich: 1E+9 was translating to 1E-9 
        if (scale >= 0) val.append('+');
        val.append(scale);

I can't find how to attach the testcases, so i posted to a url:
www.totalcross.com/TCTestWin.java

The commented out tests run with java.math.BigDecimal/BigInteger, but fail on
classpath's.

hth

   guich


-- 
           Summary: BigDecimal fails on lots of tests
           Product: classpath
           Version: 0.98
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: guich at superwaba dot com dot br


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39743





reply via email to

[Prev in Thread] Current Thread [Next in Thread]