sal/rtl/math.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 1ad0ec4f10270eb44b558e6e8c6261d793fddb2f Author: Eike Rathke <er...@redhat.com> AuthorDate: Tue Dec 1 19:08:26 2020 +0100 Commit: Eike Rathke <er...@redhat.com> CommitDate: Wed Dec 2 11:36:33 2020 +0100 Related: tdf#138360 Rounding integers to decimals is futile Change-Id: Ica25747a26d6c2637c46808d1b73aeeed6e1df37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107001 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit 49aff144c72a5258cf2ca392a0cfb7a31fb86819) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107017 diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx index 1d6cb88327f9..10417742b3a2 100644 --- a/sal/rtl/math.cxx +++ b/sal/rtl/math.cxx @@ -1146,7 +1146,10 @@ double SAL_CALL rtl_math_round(double fValue, int nDecPlaces, // Rounding to decimals between integer distance precision (gaps) does not // make sense, do not even try to multiply/divide and introduce inaccuracy. - if (nDecPlaces >= 0 && fValue >= (static_cast<sal_Int64>(1) << 52)) + // For same reasons, do not attempt to round integers to decimals. + if (nDecPlaces >= 0 + && (fValue >= (static_cast<sal_Int64>(1) << 52) + || isRepresentableInteger(fValue))) return bSign ? -fValue : fValue; double fFac = 0; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits