Patch Ping: Double.parseDouble cannot handle NaN, Infinity or-Infinity
Mark Anderson
mark@panonet.net
Mon Mar 21 18:52:00 GMT 2005
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?
--
Regards,
Mark
2005-03-21 Mark Anderson <mark@panonet.net>
* java/lang/Double.java: Add constants for string representation of NaN,
Infinity and -Infinity
* java/lang/natDouble.cc
(parseDouble): Handle NaN, Infinity and -Infinity as parameters
(toString): Replaced returning new String for NaN, Infinity and -Infinity
with using constants
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Double.patch
Type: text/x-diff
Size: 621 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050321/88f4d0fc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: natDouble.patch
Type: text/x-diff
Size: 1167 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050321/88f4d0fc/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FloatString.java
Type: text/x-java
Size: 1028 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050321/88f4d0fc/attachment-0002.bin>
More information about the Java-patches
mailing list