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

Dalibor Topic robilad at kaffe.org
Mon Oct 11 14:48:11 PDT 2004


Noa Resare wrote:
> 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.

Thanks a lot for the patch, Noa, and catching that rather weird bug :) 
Checked in, keep 'em coming.

> ps. the mauve regressions when comparing 1.1.4 to HEAD cvs is steadily
> shrinking. Now down to 6 uninvestigated.

Good work! Thanks for that, too :)

cheers,
dalibor topic




More information about the kaffe mailing list