Skip to content

Commit ea1a1e1

Browse files
committed
Add concepts to cmath functions
1 parent 36521a8 commit ea1a1e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+206
-123
lines changed

include/boost/decimal/decimal128.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,10 @@ class decimal128 final
214214

215215
friend constexpr auto d128_mod_impl(decimal128 lhs, decimal128 rhs, const decimal128& q, decimal128& r) noexcept -> void;
216216

217-
template <typename T>
217+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
218218
friend constexpr auto ilogb(T d) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, int>;
219219

220-
template <typename T>
220+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
221221
friend constexpr auto logb(T num) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T>;
222222

223223
public:
@@ -537,7 +537,7 @@ class decimal128 final
537537
friend constexpr auto operator~(decimal128 rhs) noexcept -> decimal128;
538538

539539
// <cmath> functions that need to be friends
540-
template <typename T>
540+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
541541
friend constexpr auto frexp10(T num, int* expptr) noexcept
542542
-> std::enable_if_t<detail::is_decimal_floating_point_v<T>,
543543
std::conditional_t<std::is_same<T, decimal32>::value, std::uint32_t,

include/boost/decimal/decimal32.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ class decimal32 final // NOLINT(cppcoreguidelines-special-member-functions,hicpp
162162
friend constexpr auto div_impl(decimal32 lhs, decimal32 rhs, decimal32& q, decimal32& r) noexcept -> void;
163163
friend constexpr auto mod_impl(decimal32 lhs, decimal32 rhs, const decimal32& q, decimal32& r) noexcept -> void;
164164

165-
template <typename T>
165+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
166166
friend constexpr auto ilogb(T d) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, int>;
167167

168-
template <typename T>
168+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
169169
friend constexpr auto logb(T num) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T>;
170170

171171
// Debug bit pattern
@@ -532,7 +532,7 @@ class decimal32 final // NOLINT(cppcoreguidelines-special-member-functions,hicpp
532532
friend constexpr auto fmad32(decimal32 x, decimal32 y, decimal32 z) noexcept -> decimal32;
533533

534534
// Related to <cmath>
535-
template <typename T>
535+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
536536
friend constexpr auto frexp10(T num, int* expptr) noexcept
537537
-> std::enable_if_t<detail::is_decimal_floating_point_v<T>,
538538
std::conditional_t<std::is_same<T, decimal32>::value, std::uint32_t,

include/boost/decimal/decimal64.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ class decimal64 final
205205

206206
friend constexpr auto d64_mod_impl(decimal64 lhs, decimal64 rhs, const decimal64& q, decimal64& r) noexcept -> void;
207207

208-
template <typename T>
208+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
209209
friend constexpr auto ilogb(T d) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, int>;
210210

211-
template <typename T>
211+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
212212
friend constexpr auto logb(T num) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T>;
213213

214214
public:
@@ -527,7 +527,7 @@ class decimal64 final
527527
friend constexpr auto operator~(decimal64 lhs) noexcept -> decimal64;
528528

529529
// <cmath> functions that need to be friends
530-
template <typename T>
530+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
531531
friend constexpr auto frexp10(T num, int* expptr) noexcept
532532
-> std::enable_if_t<detail::is_decimal_floating_point_v<T>,
533533
std::conditional_t<std::is_same<T, decimal32>::value, std::uint32_t,

include/boost/decimal/detail/cmath/abs.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
#include <boost/decimal/fwd.hpp>
99
#include <boost/decimal/detail/config.hpp>
1010
#include <boost/decimal/detail/type_traits.hpp>
11+
#include <boost/decimal/detail/concepts.hpp>
1112
#include <type_traits>
1213
#include <cmath>
1314

14-
namespace boost { namespace decimal {
15+
namespace boost {
16+
namespace decimal {
1517

16-
template <typename T>
18+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
1719
constexpr auto abs BOOST_DECIMAL_PREVENT_MACRO_SUBSTITUTION (T rhs) noexcept
1820
-> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T>
1921
{

include/boost/decimal/detail/cmath/acosh.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111

1212
#include <boost/decimal/fwd.hpp> // NOLINT(llvm-include-order)
1313
#include <boost/decimal/detail/type_traits.hpp>
14+
#include <boost/decimal/detail/concepts.hpp>
1415
#include <boost/decimal/numbers.hpp>
1516

16-
namespace boost { namespace decimal {
17+
namespace boost {
18+
namespace decimal {
1719

18-
template<typename T>
20+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
1921
constexpr auto acosh(T x) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T>
2022
{
2123
const auto fpc = fpclassify(x);

include/boost/decimal/detail/cmath/asinh.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111

1212
#include <boost/decimal/fwd.hpp> // NOLINT(llvm-include-order)
1313
#include <boost/decimal/detail/type_traits.hpp>
14+
#include <boost/decimal/detail/concepts.hpp>
1415
#include <boost/decimal/numbers.hpp>
1516

16-
namespace boost { namespace decimal {
17+
namespace boost {
18+
namespace decimal {
1719

18-
template<typename T>
20+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
1921
constexpr auto asinh(T x) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T> // NOLINT(misc-no-recursion)
2022
{
2123
T result { };

include/boost/decimal/detail/cmath/atanh.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111

1212
#include <boost/decimal/fwd.hpp> // NOLINT(llvm-include-order)
1313
#include <boost/decimal/detail/type_traits.hpp>
14+
#include <boost/decimal/detail/concepts.hpp>
1415
#include <boost/decimal/numbers.hpp>
1516

16-
namespace boost { namespace decimal {
17+
namespace boost {
18+
namespace decimal {
1719

18-
template<typename T>
20+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
1921
constexpr auto atanh(T x) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T>
2022
{
2123
T result { };

include/boost/decimal/detail/cmath/ceil.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
#include <boost/decimal/detail/type_traits.hpp>
1111
#include <boost/decimal/detail/power_tables.hpp>
1212
#include <boost/decimal/detail/apply_sign.hpp>
13+
#include <boost/decimal/detail/concepts.hpp>
1314
#include <boost/decimal/detail/cmath/fpclassify.hpp>
1415
#include <boost/decimal/detail/cmath/frexp10.hpp>
1516
#include <type_traits>
1617
#include <cmath>
1718

18-
namespace boost { namespace decimal {
19+
namespace boost {
20+
namespace decimal {
1921

20-
template <typename T>
22+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
2123
constexpr auto ceil BOOST_DECIMAL_PREVENT_MACRO_SUBSTITUTION (T val) noexcept
2224
-> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T>
2325
{

include/boost/decimal/detail/cmath/cos.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@
99
#include <boost/decimal/fwd.hpp>
1010
#include <boost/decimal/numbers.hpp>
1111
#include <boost/decimal/detail/type_traits.hpp>
12+
#include <boost/decimal/detail/concepts.hpp>
1213
#include <boost/decimal/detail/cmath/cos.hpp>
1314
#include <boost/decimal/detail/cmath/remquo.hpp>
1415
#include <boost/decimal/detail/cmath/impl/sin_impl.hpp>
1516
#include <boost/decimal/detail/cmath/impl/cos_impl.hpp>
1617
#include <type_traits>
1718
#include <cstdint>
1819

19-
namespace boost { namespace decimal {
20+
namespace boost {
21+
namespace decimal {
2022

21-
template<typename T>
23+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
2224
constexpr auto cos(T x) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T> // NOLINT(misc-no-recursion)
2325
{
2426
T result { };

include/boost/decimal/detail/cmath/cosh.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111

1212
#include <boost/decimal/fwd.hpp> // NOLINT(llvm-include-order)
1313
#include <boost/decimal/detail/type_traits.hpp>
14+
#include <boost/decimal/detail/concepts.hpp>
1415
#include <boost/decimal/numbers.hpp>
1516

16-
namespace boost { namespace decimal {
17+
namespace boost {
18+
namespace decimal {
1719

18-
template<typename T>
20+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
1921
constexpr auto cosh(T x) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T> // NOLINT(misc-no-recursion)
2022
{
2123
const auto fpc = fpclassify(x);

0 commit comments

Comments
 (0)