C++ Boost

gcd_lcm - GCD and LCM

はじめに

detail/gcd_lcm.hpp は2つの汎用整数アルゴリズムを提供する。 最大公約数と最小公倍数である。

梗概

namespace details {
namespace pool {

template <typename Integer>
Integer gcd(Integer A, Integer B);

template <typename Integer>
Integer lcm(Integer A, Integer B);

} // namespace pool
} // namespace details

意味

Symbol Table
SymbolMeaning
IntegerAn integral type
A, BValues of type Integer
Semantics
ExpressionResult TypePreconditionNotes
gcd(A, B)IntegerA > 0 && B > 0AB の最大公約数を返す。
lcm(A, B)IntegerA > 0 && B > 0AB の最小公倍数を返す。

実装上の注意

速度のため、A > Bとする。

依存性

なし。

将来の方向性

このヘッダーは Boost algorithms library に置き換えられるかもしれない。


Copyright © 2000, 2001 Stephen Cleary (shammah@voyager.net)

This file can be redistributed and/or modified under the terms found in copyright.html

This software and its documentation is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.