Run-time GCD & LCM Determination

| Home | Libraries | People | FAQ | More

### Run-time GCD & LCM Determination

Header: <boost/math/common_factor_rt.hpp>

    template < typename IntegerType >
    IntegerType  boost::math::gcd( IntegerType const &a, IntegerType const &b );

    template < typename IntegerType >
    IntegerType  boost::math::lcm( IntegerType const &a, IntegerType const &b );

The boost::math::gcd function template returns the greatest common (nonnegative) divisor of the two integers passed to it. The boost::math::lcm function template returns the least common (nonnegative) multiple of the two integers passed to it. The function templates are parameterized on the function arguments' IntegerType, which is also the return type. Internally, these function templates use an object of the corresponding version of the gcd_evaluator and lcm_evaluator class templates, respectively.