This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFA: strtod patch



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 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]