diff options
author | David Ostrovsky <david@ostrovsky.org> | 2017-05-04 19:14:13 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-05-05 09:27:40 +0200 |
commit | 9f68be99919871283238e4a12940d9581d724af2 (patch) | |
tree | 1836de40f4ca45836337f65cf9adfd778906f0cb /tools/source/generic | |
parent | 4c4360aeacd379eb8f1f321bea792a7ba2a8237b (diff) |
Use gcd from boost::math::gcd
According to the documentation "Run-time GCD & LCM Determination": [1],
gcd should be consumed from boost::math::gcd.
[1] <http://www.boost.org/doc/libs/1_64_0/libs/math/doc/html/math_toolkit/run_time.html>
Change-Id: I026a4e8ead75399765eb73fa5434a57958676383
Reviewed-on: https://gerrit.libreoffice.org/37260
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools/source/generic')
-rw-r--r-- | tools/source/generic/fract.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index bc9bef467e86..afcb2e60ba42 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -30,6 +30,7 @@ #include <algorithm> #include <cmath> +#include <boost/math/common_factor_rt.hpp> #include <boost/rational.hpp> template<typename T> @@ -180,8 +181,8 @@ namespace T den = r.denominator(); // Avoid overflow and preserve normalization - T gcd1 = boost::integer::gcd(i.numerator(), den); - T gcd2 = boost::integer::gcd(num, i.denominator()); + T gcd1 = boost::math::gcd(i.numerator(), den); + T gcd2 = boost::math::gcd(num, i.denominator()); bool fail = false; fail |= o3tl::checked_multiply(i.numerator() / gcd1, num / gcd2, num); |