Bug #759
closedFloat-to-string conversion problems
0%
Description
SourceForge user: mhkay
In 8.7 a new module was introduced to handle
conversions from float/double to string. This module
can cause performance problems.
Because the algorithm uses floating-point arithmetic,
rounding errors can sometimes accumulate, and to
compensate for this, the algorithm applies a small
correction to the result as the last thing it does.
However, there are some cases where the number to be
formatted is close to a power of 10 (for example the
float 0.00001) where the rounding error causes the
intermediate result to be out by a factor of ten and in
this case the minal adjustment is applied millions of
times, causing chronically poor performance.
The algorithm used by this module,
FloatingPointConverter, was from a Java text book by
Jack Shirazi, but it has been found inadequate to meet
the requirements of the XPath conversion rules. I have
therefore implemented a new version of this module,
using an algorithm publish by Guy Steele and Jon White
in SIGPLAN '90: this algorithm uses integer arithmetic
only and gives much more reliable (and faster) results.
The new module is attached, and should be used as a
plug-in replacement for
net.sf.saxon.value.FloatingPointConverter.java
Michael Kay
Files
No data to display
Please register to edit this issue