harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohanraj Loganathan <mohanra...@gmail.com>
Subject [classlib][luni]Float.toString - inaccuracy in the last digit
Date Tue, 27 Jul 2010 17:33:16 GMT
Following test[1] fails in Harmony. But passes in RI.

[1] test:
		float r=6.0214271E18f;
		String s=Float.toString(r);
		assertEquals("6.0214271E18",s);
Harmony prints: 6.021427E18  (note '1' is missing from the converted string)

When i looked into the implementation of harmony, i come to know its a
limitation to the algorithm implemented in Harmony (Printing
Floating-Point Numbers Quickly and Accurately, Robert G. Burger, and
R. Kent Dybvig, Programming Language Design and Implementation (PLDI)
1996, pp.108-116)

https://svn.apache.org/repos/asf/harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/native/luni/shared/dblparse.c

function: java_org_apache_harmony_luni_util_NumberConverter_bigIntDigitGeneratorInstImpl

I am clue-less to find the flaw in the implementation. Any comments
from experts of this area?

I will raise a JIRA for this issue.

Thanks and Regards,
Mohan

Mime
View raw message