This is the mail archive of the java-patches@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]
Other format: [Raw text]

Re: Patch Ping: Double.parseDouble cannot handle NaN, Infinity or-Infinity


Hi Mark,

Thanks for the patch. This approach will be a bit slow because we'd be allocating 3 strings for every call to parseDouble(). Instead, it would be better to either:

- do a C strcmp() after the String data has been converted to UTF.
or, perhaps even better:
- put "private static" Java fields containing strings for "NaN", "Infinity", etc into Double.java, and use those for the string comparisons. These strings also be reused in the toString() implementation which currently allocates new strings every time.


Also, since NaN and infinity are probably rare cases, perhaps we can only check for the special cases in the event that the _strtod_r call fails?

Is there a mauve test for this?

Bryce

Mark Anderson wrote:

http://gcc.gnu.org/ml/java-patches/2005-q1/msg00587.html




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