Clean-room implementation of Double::toString(double) and Float::toString(float)

raffaello.giulietti at raffaello.giulietti at
Fri Mar 30 16:50:31 UTC 2018


the topic I would like to work on is to solve the bugs described at about the
results produced by the current implementation of
Double::toString(double). I noticed that after all these years most of
the issues illustrated in the bug report still remain unsolved in the
latest OpenJDK.

To that end, I have worked on a clean-room implementation that:
* Could be used as a drop-in replacement for Double::toString(double)
* Solves *all* the anomalies still present in OpenJDK.
* Produces identical results otherwise.
* Has extensive mathematical documentation on the inner workings.
* Is way faster than the current OpenJDK implementation.
* Uses significantly less resources in most cases.
I guess this might sound rather presumptuous, but as far as I can tell
the claims are unbiased and reflect reality.

The new code also has a better specification than the current one, while
being mostly compatible. Indeed, the current specification leaves room
for interpretation and thus cannot ensure that an implementation
produces consistent and unique results from one release to the next. The
newer spec ensures a unique result.

If there is interest in the new implementation, I would be glad to
contribute my code to the OpenJDK. I've already signed the Oracle
Contributor Agreement a few days ago.

The code currently sits in its own module, is mostly polished,
thoroughly tested but has never been audited by people other than myself.

My target is to be able to integrate it in the JDK 11 LTS release, due
in late September 2018.


More information about the core-libs-dev mailing list