RFA: strtod patch

Mark Mitchell mark@codesourcery.com
Sat Sep 15 20:19:00 GMT 2001


I was somewhat surprised to find that gcj mishandled:
 public class X {
 public static void main(String[] args) {
	 System.out.println(Double.parseDouble("1.0e+0"));
 }
 }
The output was `0.0'.
It turns out that the C strtod library function used in libjava was
broken. The code removed by this patch had the effect of causing
a 0 exponent to result in EINVAL, which does not make sense to me.
Testing now on i686-pc-linux-gnu.
OK to apply?
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2001年09月15日 Mark Mitchell <mark@codesourcery.com>
	* java/lang/strtod.c: Correct handling of `...e+0'.
*** strtod.c~	Wed Apr 7 07:52:39 1999
--- strtod.c	Sat Sep 15 20:14:14 2001
*************** dig_done:
*** 242,254 ****
 	 if (esign)
 		e = -e;
 	 }
- 	 else
- 	 {
- 	 /* No exponent after an 'E' : that's an error. */
- 	 ptr->_errno = EINVAL;
- 	 e = 0;
- 	 goto ret;
- 	 }
 	}
 else
 	s = s00;
--- 242,247 ----


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /