harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulex Yang (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-747) java.lang.Doulbe.parseDouble(String) does not support Hex number
Date Fri, 01 Sep 2006 10:15:24 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-747?page=comments#action_12432114 ] 
            
Paulex Yang commented on HARMONY-747:
-------------------------------------

Sian, sorry to not response for so long time. But I'm not sure the patch fully resolve the
issue.  Seems the parseDbl/FltFromHex() considers normalDigit either 0 or 1, but actually
RI can parse more hex format, for example, tests below:

    public static void main(String[] args) {
        Double d = Double.valueOf("0x3f.00p2");
        System.out.println(d);
    }

RI outputs: 252.0, while Harmony with the patch throws NumberFormatException. 

And from lexical syntax specified by spec on the input string of Double.valueOf()/parseDouble(),
digits other than 0/1 is acceptable. 

If you have no objections, I can look at it myself how to handle this, but it would be great
if you provide a additional patch on it:)

[1]
"
    FloatValue:
        Signopt NaN 
        Signopt Infinity 
        Signopt FloatingPointLiteral 
        Signopt HexFloatingPointLiteral 
        SignedInteger 

    HexFloatingPointLiteral:
        HexSignificand BinaryExponent FloatTypeSuffixopt 

    HexSignificand:
        HexNumeral 
        HexNumeral . 
        0x HexDigitsopt . HexDigits 
        0X HexDigitsopt . HexDigits 

    BinaryExponent:
        BinaryExponentIndicator SignedInteger 

    BinaryExponentIndicator:
        p 
        P 
"




> java.lang.Doulbe.parseDouble(String) does not support Hex number
> ----------------------------------------------------------------
>
>                 Key: HARMONY-747
>                 URL: http://issues.apache.org/jira/browse/HARMONY-747
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Richard Liang
>         Assigned To: Paulex Yang
>         Attachments: lunipatch.txt
>
>
> Hello,
> When implementing java.util.Scanner, I find that java.lang.Doulbe.parseDouble(String)
does not support Hex number. Could anyone have a look at this issue? Thanks a lot.
> The following test passes on RI, but fails on Harmony.
>     public void test_ParseDouble() {
>         String hexString = Double.toHexString(123);
>         assertEquals("0x1.ecp6", hexString);
>         
>         double d = Double.parseDouble(hexString);
>         assertEquals(123.0, d);
>     }
> Best regards,
> Richard

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