[Libreoffice-commits] core.git: tools/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 7 08:05:50 UTC 2021


 tools/source/generic/fract.cxx |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 6b46b053c78eb99d5fa4f296d25c8101ef4552d3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Apr 6 20:42:14 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Apr 7 10:05:08 2021 +0200

    ofz#32965 move fpe fix of ofz#17212 into toRational
    
    Change-Id: Ica301357f45fd289c41234b8a7059ab0ff264321
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113703
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index 6e245530281a..648c91b20550 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -40,6 +40,9 @@ static void rational_ReduceInaccurate(boost::rational<sal_Int32>& rRational, uns
 
 static boost::rational<sal_Int32> toRational(sal_Int32 n, sal_Int32 d)
 {
+    // https://github.com/boostorg/boost/issues/335 when these are std::numeric_limits<sal_Int32>::min
+    if (n == d)
+        return 1;
     return boost::rational<sal_Int32>(n, d);
 }
 
@@ -109,10 +112,6 @@ Fraction::operator double() const
         return 0.0;
     }
 
-    // https://github.com/boostorg/boost/issues/335 when these are std::numeric_limits<sal_Int32>::min
-    if (mnNumerator == mnDenominator)
-        return 1.0;
-
     return boost::rational_cast<double>(toRational(mnNumerator, mnDenominator));
 }
 


More information about the Libreoffice-commits mailing list