Skip to content

Commit f2c7cd1

Browse files
committed
Add ilogb support to decimal128
1 parent 203244b commit f2c7cd1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/boost/decimal/decimal128.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ 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>
218+
friend constexpr auto ilogb(T d) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, int>;
219+
220+
template <typename T>
221+
friend constexpr auto logb(T num) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, T>;
222+
217223
public:
218224
// 3.2.4.1 construct/copy/destroy
219225
constexpr decimal128() noexcept = default;

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
#include <boost/decimal/fwd.hpp> // NOLINT(llvm-include-order)
1212
#include <boost/decimal/detail/type_traits.hpp>
1313

14-
namespace boost { namespace decimal {
15-
16-
// TODO(mborland): Allow conversion between decimal types via a promotion system
14+
namespace boost {
15+
namespace decimal {
1716

1817
template <typename T>
1918
constexpr auto ilogb(T d) noexcept -> std::enable_if_t<detail::is_decimal_floating_point_v<T>, int>

0 commit comments

Comments
 (0)