diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-04-06 20:42:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-04-07 10:05:08 +0200 |
commit | 6b46b053c78eb99d5fa4f296d25c8101ef4552d3 (patch) | |
tree | 1b7265a6e990304e29f50ee3d8b73c61cd818877 /tools | |
parent | 79ef3c7ae3b2f7be5ba6fe38997e846fd9c7e0ee (diff) |
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@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/generic/fract.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
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)); } |