34 #ifndef _GLIBCXX_EXPERIMENTAL_NUMERIC
35 #define _GLIBCXX_EXPERIMENTAL_NUMERIC 1
37 #pragma GCC system_header
39 #if __cplusplus >= 201402L
44 namespace std _GLIBCXX_VISIBILITY(default)
46 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48 namespace experimental
50 inline namespace fundamentals_v2
52 #define __cpp_lib_experimental_gcd_lcm 201411
55 template<
typename _Mn,
typename _Nn>
56 constexpr common_type_t<_Mn, _Nn>
57 gcd(_Mn __m, _Nn __n) noexcept
59 static_assert(is_integral_v<_Mn>,
60 "std::experimental::gcd arguments must be integers");
61 static_assert(is_integral_v<_Nn>,
62 "std::experimental::gcd arguments must be integers");
63 static_assert(_Mn(2) != _Mn(1),
64 "std::experimental::gcd arguments must not be bool");
65 static_assert(_Nn(2) != _Nn(1),
66 "std::experimental::gcd arguments must not be bool");
68 return std::__detail::__gcd(std::__detail::__absu<_Up>(__m),
69 std::__detail::__absu<_Up>(__n));
73 template<
typename _Mn,
typename _Nn>
77 static_assert(is_integral_v<_Mn>,
78 "std::experimental::lcm arguments must be integers");
79 static_assert(is_integral_v<_Nn>,
80 "std::experimental::lcm arguments must be integers");
81 static_assert(_Mn(2) != _Mn(1),
82 "std::experimental::lcm arguments must not be bool");
83 static_assert(_Nn(2) != _Nn(1),
84 "std::experimental::lcm arguments must not be bool");
86 return std::__detail::__lcm(std::__detail::__absu<_Up>(__m),
87 std::__detail::__absu<_Up>(__n));
92 _GLIBCXX_END_NAMESPACE_VERSION
typename make_unsigned< _Tp >::type make_unsigned_t
Alias template for make_unsigned.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
ISO C++ entities toplevel namespace is std.
constexpr common_type_t< _Mn, _Nn > lcm(_Mn __m, _Nn __n) noexcept
Least common multiple.
constexpr common_type_t< _Mn, _Nn > gcd(_Mn __m, _Nn __n) noexcept
Greatest common divisor.