[Top][All Lists]

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

[commit-cp] [bugs #10491] wrong parsing behaviour of NaN, Infinity, -Inf

From: Sven de Marothy
Subject: [commit-cp] [bugs #10491] wrong parsing behaviour of NaN, Infinity, -Infinity
Date: Sun, 10 Oct 2004 14:43:41 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922

This mail is an automated notification from the bugs tracker
 of the project: classpath.

[bugs #10491] Latest Modifications:

Changes by: 
                Sven de Marothy <address@hidden>
                Sun 10/10/2004 at 18:36 (Europe/Stockholm)

            What     | Removed                   | Added
          Resolution | None                      | Fixed
              Status | Open                      | Closed

[bugs #10491] Full Item Snapshot:

URL: <>
Project: classpath
Submitted by: 0
On: Fri 09/24/2004 at 23:47

Category:  None
Severity:  5 - Average
Resolution:  Fixed
Privacy:  Public
Assigned to:  smarothy
Status:  Closed
Platform Version:  None

Summary:  wrong parsing behaviour of NaN, Infinity, -Infinity

Original Submission:  Classpath (CVS HEAD 09.25.04) throws a 
NumberFormatException although [+/-]NaN|Infinity are possible float/double 
values according to Java documentation.

Follow-up Comments

Date: Thu 10/07/2004 at 22:42       By: Sven de Marothy <smarothy>
I've submitted a quick-fix for this to the classpath-patches list. 

Date: Thu 10/07/2004 at 16:05       By: David Gilbert <trebligd>
I've written some Mauve tests that cover these failing cases (plus some other 
non-failing cases).  I'll post them to the mauve-patches mailing list now.

Date: Thu 10/07/2004 at 14:29       By: 0 <None>
Simple test cases:

try {
  if(Double.POSITIVE_INFINITY == Double.parseDouble("Infinity")) {
    // OK
  } else {
    // WRONG
} catch(NumberFormatException nfe){
  // should not happen (but is what its doing now)

aside from the given comparison it can be replaced with:
Double.POSITIVE_INFINITY == Double.parseDouble("+Infinity")
Double.NEGATIVE_INFINITY == Double.parseDouble("-Infinity")
Double.NaN == Double.parseDouble("NaN");

Float.POSITIVE_INFINITY == Float.parseFloat("+Infinity")
Float.NEGATIVE_INFINITY == Float.parseFloat("-Infinity")
Float.NaN == Float.parseFloat("NaN");

for all examples the string may contain whitespace before and after the 'word'.

For detailed info, follow this link:

  Message sent via/by Savannah

reply via email to

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