Function lcm

Synopsis

#include "breeze/mathematics/lcm.hpp"

template <typename T>
constexpr T lcm(T a, T b)

Description

Returns the least common multiple of two integers.

If T is not an integral type the program is ill-formed. If the least common multiple of |a| and |b| is not representable as a value of type T, the behavior is undefined.

Returns
If either a or b is zero, returns zero. Otherwise it returns the least common multiple of |a| and |b|.
Note
This template diverges from the C++17 specification for the same reason why breeze::gcd() does.
See
gcd().

Mentioned in

Source

Line 42 in breeze/mathematics/lcm.hpp.