5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MATH_LCM_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MATH_LCM_HPP_
16#include "arene/base/stdlib_choice/enable_if.hpp"
17#include "arene/base/stdlib_choice/is_integral.hpp"
31template <typename Integral, constraints<std::enable_if_t<std::is_integral<Integral>::value> > =
nullptr>
32constexpr auto lcm(Integral lhs, Integral rhs)
noexcept -> Integral {
33 if ((lhs == Integral{}) || (rhs == Integral{})) {
38 return abs((lhs /
gcd(lhs, rhs)) * rhs);
Definition accumulate.hpp:37
constexpr auto abs(Number value) noexcept -> Number
Calculate the absolute value of a number.
Definition abs.hpp:46
constexpr auto lcm(Integral lhs, Integral rhs) noexcept -> Integral
Calculates the Least Common Multiple (LCM) of two integral values.
Definition lcm.hpp:32
constexpr auto gcd(Integral lhs, Integral rhs) noexcept -> Integral
Calculates the Greatest Common Divisor (GCD) of two Integral values.
Definition gcd.hpp:26
Definition accumulate.hpp:36