Home / list of functions / fwnbi::gcd
template <size_t B, class D>
constexpr basic_integer<B, D, false> gcd(
    const basic_integer<B, D, false>& lhs,
    const basic_integer<B, D, false>& rhs
) noexcept;
constexpr since C++14

Calculates greatest common divisor of two integers.

Example
#include "fwnbi.hpp"
#include <iostream>

using namespace fwnbi::literals;

int main() {
    std::cout << "gcd(54, 24) = " << fwnbi::gcd(54_ull128, 24_ull128) << '\n';
}
Output
gcd(54, 24) = 6