[Libreoffice-commits] core.git: sal/rtl
Eike Rathke (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 1 23:28:16 UTC 2020
sal/rtl/math.cxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 49aff144c72a5258cf2ca392a0cfb7a31fb86819
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Tue Dec 1 19:08:26 2020 +0100
Commit: Eike Rathke <erack at redhat.com>
CommitDate: Wed Dec 2 00:27:30 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 <erack at redhat.com>
Tested-by: Jenkins
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;
More information about the Libreoffice-commits
mailing list