Dear all,
I hope this is the right place to post a patch fo libjava.
I'm using libjava from GCC-3.0.4 on Linux i386.
I tried to convert a string of the form 1.234E+000 to a double using
Double.doubleValue(). The result was allways zero (no NumberFormatException).
IMHO, this is a bug. I traced that down until finding the responsible lines
of code in java/lang/strtod.c. The following patch works for me, but better
take a deeper look on it.
BTW, why must libjava implement all this itself? Is it to achieve platform
independency down to the last bit? Does it take advantage of FPU, if one is
present ?
Yours sincerely
Thomas Hergenhahn
--- strtod.c Wed Apr 7 16:52:39 1999
+++ strtod.c.new Wed Apr 3 19:14:18 2002
@@ -245,13 +245,32 @@
else
{
/* No exponent after an 'E' : that's an error. */
- ptr->_errno = EINVAL;
+ /* This seems not to be true. We can arrive here parsing a
+ * number string of the form ....E0000.. And to my understanding,
+ * this is a number times 1 and perfectly legal.? So I propose
+ * to simply set e to 0 and continue. If there is *really*
+ * no digit after the 'E' we will find ourselves behind next
+ * "else".
+ * [EMAIL PROTECTED]
+ */
+ //ptr->_errno = EINVAL;
e = 0;
- goto ret;
+ //goto ret;
}
}
- else
+ else
+ {
+ /* No exponent after an 'E' : that's an error. */
+ /* I thimk this is not true before here. So we could place the
+ * the error exit code here:
+ */
+ ptr->_errno = EINVAL;
+ e = 0;
+ goto ret;
+
+ /* I do not see what this line means... */
s = s00;
+ }
}
if (!nd)
{