summaryrefslogtreecommitdiff
path: root/tools/source/generic/fract.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-05 19:15:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-10-05 21:29:38 +0200
commitf9877e1e9abd10bb5bfcae00269c743ca6e62c60 (patch)
treeca10dd1e8733a94b3c865f19adedd4566492a77e /tools/source/generic/fract.cxx
parent20a1904945ea95df0a5d689705d2db97a6424109 (diff)
ofz#17212 Floating point exception
deploy a workaround, bug logged against boost as: https://github.com/boostorg/boost/issues/335 Change-Id: I9791133e926dd474ddc5960a33fd90592ce3dcb3 Reviewed-on: https://gerrit.libreoffice.org/80304 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'tools/source/generic/fract.cxx')
-rw-r--r--tools/source/generic/fract.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index 3a8eb09822c8..8ec17b94a477 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -104,6 +104,10 @@ 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));
}