1 // Copyright (C) 2000 Stephen Cleary
\r
3 // Distributed under the Boost Software License, Version 1.0. (See
\r
4 // accompanying file LICENSE_1_0.txt or copy at
\r
5 // http://www.boost.org/LICENSE_1_0.txt)
\r
7 // See http://www.boost.org for updates, documentation, and revision history.
\r
9 #ifndef BOOST_POOL_GCD_LCM_HPP
\r
10 #define BOOST_POOL_GCD_LCM_HPP
\r
17 // Greatest common divisor and least common multiple
\r
20 // gcd is an algorithm that calculates the greatest common divisor of two
\r
21 // integers, using Euclid's algorithm.
\r
23 // Pre: A > 0 && B > 0
\r
24 // Recommended: A > B
\r
25 template <typename Integer>
\r
26 Integer gcd(Integer A, Integer B)
\r
30 const Integer tmp(B);
\r
39 // lcm is an algorithm that calculates the least common multiple of two
\r
42 // Pre: A > 0 && B > 0
\r
43 // Recommended: A > B
\r
44 template <typename Integer>
\r
45 Integer lcm(const Integer & A, const Integer & B)
\r
54 } // namespace details
\r
56 } // namespace boost
\r