Go to the source code of this file.
|
template<typename T > |
constexpr T | internal::lcm_compute (const T a, const T b) noexcept |
|
template<typename T1 , typename T2 , typename TC = common_t<T1,T2>> |
constexpr TC | internal::lcm_type_check (const T1 a, const T2 b) noexcept |
|
template<typename T1 , typename T2 > |
constexpr common_t< T1, T2 > | lcm (const T1 a, const T2 b) noexcept |
| Compile-time least common multiple (LCM) function. More...
|
|
◆ lcm()
template<typename T1 , typename T2 >
constexpr common_t< T1, T2 > lcm |
( |
const T1 |
a, |
|
|
const T2 |
b |
|
) |
| |
|
constexprnoexcept |
Compile-time least common multiple (LCM) function.
- Parameters
-
a | integral-valued input. |
b | integral-valued input. |
- Returns
- the least common multiple between integers
a
and b
using the representation
\[ \text{lcm}(a,b) = \dfrac{| a b |}{\text{gcd}(a,b)} \]
where \( \text{gcd}(a,b) \) denotes the greatest common divisor between \( a \) and \( b \).