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
Nobody/Anonymous
Performance
v8.7
Public
| Filename | Description | Download |
|---|---|---|
| FloatingPointConverter.java | Replacement for net.sf.saxon.value.FloatingPointConverter | Download |
| Field | Old Value | Date | By |
|---|---|---|---|
| status_id | Open | 2006-04-13 11:20 | mhkay |
| close_date | - | 2006-04-13 11:20 | mhkay |
| priority | 5 | 2006-02-27 17:45 | mhkay |
| File Added | 169015: FloatingPointConverter.java | 2006-02-27 15:19 | mhkay |
Copyright © 2010 Geeknet, Inc. All rights reserved. Terms of Use