std::experimental::lcm(3)
π std::experimental::lcm π
πΈ NAME πΈ
okay so this page lives in the C++ Standard Libary manual (yes, βLibaryβ β thatβs literally how the header spells it, and we are not editing the header, bestie π ), and the name is exactly:
std::experimental::lcm - std::experimental::lcm
like, thatβs the whole name. no extra subtitle. it ate and left no crumbs. β¨
β¨ Synopsis β¨
Defined in header <experimental/numeric>:
template< class M, class N > (library
fundamentals TS v2)
constexpr std::common_type_t<M, N> lcm( M m, N n );
this bad boy computes the least common multiple of the integers m and n. itβs giving math but make it constexpr. π§
π Parameters π
m,nβ integer values. thatβs the whole vibe. π
π Return value π
okay so hereβs the tea:
- If either
mornis zero, it returns zero. periodt. π - Otherwise, it returns the least common multiple of
|m|and|n|. slay. π₯
Remarks
- If either
MorNis not an integer type, or if either is (possibly cv-qualified)bool, the program is ill-formed. π¨ - The behavior is undefined if
|m|,|n|, or the least common multiple of|m|and|n|is not representable as a value of typestd::common_type_t<M, N>. no cap, thatβs undefined behavior, so donβt play with it. π
π¦ Exceptions π¦
Throws no exceptions. not a single one. iconic. π«Ά
π See also π
gcdβ constexpr function template returning the greatest common divisor of two integers (function template). bestie behavior. π
source vibe check: http://cppreference.com, dated 2024.06.10. mwah π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms