Patch Ping: Double.parseDouble cannot handle NaN, Infinity or-Infinity
Andrew Haley
aph@redhat.com
Mon Mar 21 20:53:00 GMT 2005
Mark Anderson writes:
> On Thursday 17 March 2005 15:13, Andrew Haley wrote:
> > Mark Anderson writes:
> > > I am working on the suggestions you made but have a question about CNI.
> > >
> > > I have added the string fields to Double.java eg.
> > >
> > > private static final String nanString = "NaN";
> > >
> > > In the CNI header this field is represented as follows:
> > >
> > > private:
> > > static ::java::lang::String *nanString;
> > >
> > > My question is how do I access the value of nanString from CNI? I had
> > > thought I could just do str->equals(nanString) for my comparisons
> >
> > That should work. What problems are you seeing?
> >
> > Andrew.
>
> I have attached a new version of my patch and also a small test program.
>
> If you run the test program with the patch applied, you still get a NumberFormatException.
> However, if you uncomment the first println call, the test is successful! Any idea why?
Yes. If you use local class data in a static method, you have to make
sure your own class is initialized. Compiled java methods do this
automagically.
Call _Jv_InitClass (&java::lang::Double::class$);
Andrew.
More information about the Java-patches
mailing list