harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ray Chen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6418) [classlib][luni]FloatTest.test_parseFloat_LString_Harmony6261 failed on RI
Date Mon, 18 Jan 2010 09:14:54 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801711#action_12801711
] 

Ray Chen commented on HARMONY-6418:
-----------------------------------

Hi, 
I have narrowed down the bug to longDigitGenerator of NumberConverter.java, and following
patch can make the test passed both on RI and harmony.

However, it is just a "blind fix", actually I don't understand the algorithm very much, can
anyone explain the longDigitGenerator () method algorithm?

Index: luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java
===================================================================
--- luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java	(revision
895535)
+++ luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java	(working
copy)
@@ -788,7 +788,7 @@
     public void test_parseFloat_LString_Harmony6261() {
         // Regression test for HARMONY-6261
         float f = new Float("2147483648");
-        assertEquals("2.1474836E9", Float.toString(f));
+        assertEquals("2.14748365E9", Float.toString(f));
 
         doTestCompareRawBits("123456790528.000000000000000f", 0x51e5f4c9, "1.2345679E11");
         doTestCompareRawBits("8589934592", 0x50000000, "8.5899346E9");
Index: luni/src/main/java/org/apache/harmony/luni/util/NumberConverter.java
===================================================================
--- luni/src/main/java/org/apache/harmony/luni/util/NumberConverter.java	(revision 895535)
+++ luni/src/main/java/org/apache/harmony/luni/util/NumberConverter.java	(working copy)
@@ -220,7 +220,7 @@
 			boolean mantissaIsZero, int p) {
 		long R, S, M;
 		if (e >= 0) {
-			M = 1l << e;
+			M = 1l << e -1 ;
 			if (!mantissaIsZero) {
 				R = f << (e + 1);
 				S = 2;
@@ -279,7 +279,7 @@
 			low = R < M; // was M_minus
 			high = R + M > S; // was M_plus
 
-			if (low || high)
+			if (low || high || setCount>= 22)
 				break;
 
 			R = R * 10;


> [classlib][luni]FloatTest.test_parseFloat_LString_Harmony6261 failed on RI
> --------------------------------------------------------------------------
>
>                 Key: HARMONY-6418
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6418
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ray Chen
>
> RI got 2.14748365E9 instead of 2.1474836E9

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message