bug-classpath
[Top][All Lists]
Advanced

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

[Bug classpath/28096] New: parseFloat and parseDouble faulty on small nu


From: jan at gatespacetelematics dot com
Subject: [Bug classpath/28096] New: parseFloat and parseDouble faulty on small numbers.
Date: 20 Jun 2006 12:05:15 -0000

It seems that converting Double/Float -> String -> Double/Float, doesn't
preserve the value for small values.

The following test:

class j {
  public static void main(String [] v) throws NumberFormatException {
    System.out.println("Double.MIN_VALUE = " + Double.MIN_VALUE);
    System.out.println("Float.MIN_VALUE = " + Float.MIN_VALUE);
    System.out.println("String Double.MIN_VALUE = " +
         Double.parseDouble(Double.toString(Double.MIN_VALUE)));
    System.out.println("String Float.MIN_VALUE = " +
         Float.parseFloat(Float.toString(Float.MIN_VALUE)));
  }
}

With Cacao it generates:

Double.MIN_VALUE = 4.9E-324
Float.MIN_VALUE = 1.4E-45
String Double.MIN_VALUE = 5.0E-324
String Float.MIN_VALUE = 1.4012985E-45

With Sun JDK 1.4 it generates:

Double.MIN_VALUE = 4.9E-324
Float.MIN_VALUE = 1.4E-45
String Double.MIN_VALUE = 4.9E-324
String Float.MIN_VALUE = 1.4E-45


-- 
           Summary: parseFloat and parseDouble faulty on small numbers.
           Product: classpath
           Version: 0.91
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan at gatespacetelematics dot com
  GCC host triplet: i686-pc-linux-gnu


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





reply via email to

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