tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
lcm.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2#ifndef TETL_NUMERIC_LCM_HPP
3#define TETL_NUMERIC_LCM_HPP
4
9
10namespace etl {
11
18template <typename M, typename N>
20[[nodiscard]] constexpr auto lcm(M m, N n) -> common_type_t<M, N>
21{
22 return (m * n) / gcd(m, n);
23}
24
25} // namespace etl
26
27#endif // TETL_NUMERIC_LCM_HPP
constexpr auto gcd(M m, N n) noexcept -> etl::common_type_t< M, N >
Computes the greatest common divisor of the integers m and n.
Definition gcd.hpp:16
constexpr auto lcm(M m, N n) -> common_type_t< M, N >
Computes the least common multiple of the integers m and n.
Definition lcm.hpp:20
Definition adjacent_find.hpp:8
constexpr bool is_integral_v
Definition is_integral.hpp:28
constexpr bool is_same_v
Definition is_same.hpp:11
typename common_type< T... >::type common_type_t
Definition common_type.hpp:50