diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-02-15 09:20:52 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-02-17 21:46:58 +0100 |
commit | 9eb9083ff2fdaeb96399a0830a4394de4e29ef64 (patch) | |
tree | 046cc63551286fb3e59c6b79ebeea505a23b2eb0 /readlicense_oo | |
parent | ee373f34ae1509e8d9fffaf4b5140ee9c35e8d41 (diff) |
Use Dragonbox to implement doubleTo*String*
This header-only library is accurate in decimal representation of
doubles; provides API that allows to create custom representation
- so it's possible to use custom decimal separators and grouping.
This allows to unify all corner cases: integers, numbers close to
DBL_MAX, up-rounding to the next decade.
Note that Dragonbox creates the shortest decimal representation
of the number, that is unambiguously convertible back to the same
number; thus it may hide trailing digits that are unneeded for
such conversion.
The functional changes are minimal, and beneficial:
1. Rounding numbers close to DBL_MAX now takes into account the
bEraseTrailingDecZeros argument, as it should, allowing to have
"1.8E+308" for rounding DBL_MAX to 2 decimals without trailing
zeroes, instead of previous "1.80E+308".
2. Incorrect rounding is fixed in some cases, e.g. 9.9999999999999929
rounded to 10 previously using rtl_math_DecimalPlaces_Max.
3. Representing the number in the shortest way may change display
of some printed numbers. E.g., 5th greatest double is represented
as "1.797693134862315E+308" instead of a bit longer, but giving
the same double on roundtrip, "1.7976931348623149E+308". This would
generally look better for some numbers similar to the famous 0.1,
where users would likely expect more "round" representation where
it's unambiguous (but we still truncate to 15 significant decimals
anyway - so there's no point in pretending to provide exact digits
for actual binary representation).
These are reflected in the unit tests affected by the change.
Change-Id: I05e20274a30eec499593ee3e9ec070e1269232a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129948
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'readlicense_oo')
-rw-r--r-- | readlicense_oo/license/license.xml | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/readlicense_oo/license/license.xml b/readlicense_oo/license/license.xml index 56b36c71fa02..f0a2484b8acb 100644 --- a/readlicense_oo/license/license.xml +++ b/readlicense_oo/license/license.xml @@ -1844,6 +1844,27 @@ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</p> </div> + <h2>Dragonbox</h2> + <p>The following software may be included in this product: Dragonbox.</p> + <p>Dragonbox code is covered by the following license:</p> + <p><a href="#a__Apache_License_version_2_0">Jump to Apache License Version 2.0</a></p> + <blockquote> + <p>--- LLVM Exceptions to the Apache 2.0 License ----</p> + + <p>As an exception, if, as a result of your compiling your source code, portions + of this Software are embedded into an Object form of such source code, you + may redistribute such embedded portions in such Object form without complying + with the conditions of Sections 4(a), 4(b) and 4(d) of the License.</p> + + <p>In addition, if you combine or link compiled forms of this Software with + software that is licensed under the GPLv2 ("Combined Software") and if a + court of competent jurisdiction determines that the patent provision (Section + 3), the indemnity provision (Section 9) or other Section of the License + conflicts with the conditions of the GPLv2, you may retroactively and + prospectively choose to deem waived or otherwise exclude such Section(s) of + the License, but only in their entirety and only with respect to the Combined + Software.</p> + </blockquote> <h2>dtoa</h2> <p>The following software may be included in this product: dtoa.</p> <p>dtoa code is covered by the MIT license:</p> |