[PATCH] 4511638: Double.toString(double) sometimes produces incorrect results

Andrew Dinn adinn at redhat.com
Thu Sep 27 12:57:02 UTC 2018


On 27/09/18 13:23, Raffaello Giulietti wrote:
  . . .
> The comments of the accessor methods that make use of this private table
> implicitly explain its semantics as well. I will add a comment to the
> field that refers to the comments in the methods.
> 
> 
> How the table was generated and thoroughly verified is currently not
> part of my contribution to OpenJDK, not because it is something secret
> or complex but because I think it is irrelevant here.

I suspect it would be far from irrelevant to someone faced with
debugging and fixing any future problem found in the code. Of course,
you may well still be around to fix it but we don't know that for sure.

> Besides, where would the generator/verifier code be placed in the
> codebase? It would be completely detached from, and unrelated to,
> everything else. But maybe there is already some mechanism in place for
> similar "bootstrapping" code in the OpenJDK. Then I would like to know
> to consider adding the generator there.

We don't absolutely need generator/verifier code (although the latter
might be helpful). The problem we face is what to do if a bug is found.
Could it simply be a table entry that is wrong or is there a detail of
the algorithm that has been mis-encoded? How would we tell?

If we have an explanation of /how/ the provided values were derived and
/why/ so derived then that would allow any such bugs to be resolved much
more easily. Omitting that background risks turning this into a one-shot
code drop rather than a very welcome contribution.

>> There are many more places in the code. What you've done is nice, but
>> it could be exemplary.
>>
> 
> As said, this will be part of a separate paper. Hope this helps for the
> moment.
Sure, a reference to a published doc would be great - assuming it makes
it clear how the quite code is derived from the maths/algorithm it
details. I'd really much prefer to have that doc before accepting the
code just in order to be sure that there is no gap between theory and
execution that some judicious commenting might close. Having recently
reviewed some math code for log, trig and power functions I am well
aware how details of specific coding operations are not always clearly
identifiable from an abstract mathematical treatment. Even when they can
be derived a few comments in the code often help avoid any resort to a
pencil and thick pad of graph paper.

When you do post a link to the paper I'll be willing to check it and
hope that I will, if needed, be able to ask you for advice to help
clarify any such gap.

regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander


More information about the core-libs-dev mailing list