Summary: | ARM SOFTFP double to ascii issue still there | ||
---|---|---|---|
Product: | classpath | Reporter: | Gert Brettlecker <gert.brettlecker> |
Component: | classpath | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | CC: | aph, ramana |
Priority: | P3 | ||
Version: | 0.98 | ||
Target Milestone: | --- | ||
See Also: | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22800 | ||
Host: | Target: | arm | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
Gert Brettlecker
2011-03-30 09:40:06 UTC
I applied the following patch for this situation on my ARM platform. This will loose precision on denormalized numbers (smaller than DBL_MIN) but it does not assert anymore: --- classpath-0.98/native/jni/java-lang/java_lang_VMDouble.c +++ classpath-0.98/native/jni/java-lang/java_lang_VMDouble.c @@ -42,6 +42,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <float.h> #include "mprec.h" #include "fdlibm.h" @@ -422,7 +423,10 @@ do { jdouble parsed_value; - assert(least_necessary_precision <= maximal_precision); + if (least_necessary_precision>maximal_precision) { + fprintf (stderr, "java.lang.VMDouble.toString error reaching maximal_precision value = %g\n", value); + break; + } /* Convert the value to a string and back. */ dtoa_toString(buf, value, least_necessary_precision, isFloat); @@ -433,10 +437,14 @@ /* We need to cast floats to float to make sure that our ineqality check works * well for floats as well as for doubles. */ - parsed_value_unequal = ( isFloat ? - (float) parsed_value != (float) value : - parsed_value != value); - + if (isFloat) { + parsed_value_unequal = ((float) parsed_value != (float) value) ; + } else if (parsed_value>value) { + parsed_value_unequal = ((parsed_value-value) > DBL_MIN); + } else { + parsed_value_unequal = ((value-parsed_value) > DBL_MIN); + } + least_necessary_precision++; } while (parsed_value_unequal); Someone has a better idea? Cheers Gert I'm trying to get my ARM hardware working. Once I have, I'll have a look. Do we still have classpath issues to look at ? It's been quite a few years now since the bug was reported- Andrew did you manage to reproduce this ? Ramana |