[kaffe] [PATCH] make Double parse doubles from long strings

Noa Resare noa at resare.com
Sat Oct 9 13:15:45 PDT 2004


When investigating a regression in BigDecimal i found out that
java.lang.Double truncates strings that it tries to parse to MAXNUMLEN
(defined to 64 in include/defs.h) before parsing it to a double.

The attached patch makes the java-string to c-string conversion be made
onto dynamically allocated memory.

If someone wonders why this is important it is because the test
((new BigDecimal("1e1000")).doubleValue))==Double.POSITIVE_INFINITY
fails. It turns out that BigDecimal.doubleValue() is implemented by
sending BigDecimal.toString() to Double.parseDouble(). Of course
BigDecimal.toString() returns a string 1000 chars long.


Please apply.

/noa

ps. the mauve regressions when comparing 1.1.4 to HEAD cvs is steadily
shrinking. Now down to 6 uninvestigated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kaffe-parsedouble.patch
Type: text/x-patch
Size: 1379 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20041009/bbf7c749/attachment-0002.bin 


More information about the kaffe mailing list