Skip to content

Commit 6e50c82

Browse files
committed
Update docs
1 parent 74383dc commit 6e50c82

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

doc/decimal/conversions.adoc

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ https://www.boost.org/LICENSE_1_0.txt
55
////
66

77
[#conversions]
8-
= Fast Type Conversions
8+
= Bit Conversions
99
:idprefix: conversions_
1010

11-
Since we have non-IEEE 754 compliant types we offer a set of functions that allow their conversion to and from the IEEE 754 compliant BID layout.
12-
These functions allow lossless conversion with more compact storage.
11+
IEEE 754 specifies two different encodings for decimal floating point types: Binary Integer Significand Field (BID), and Densely Packed Decimal Significand Field (DPD).
12+
Internally this library is implemented in the BID format for the IEEE-754 compliant types.
13+
Should the user want to capture the bit format in BID or convert to DPD we offer a family of conversion functions: `to_bid`, `from_bid`, `to_dpd`, and `from_dpd` that allow conversion to or from the bit strings regardless of encoding.
1314

1415
[source, c++]
1516
----
@@ -26,6 +27,8 @@ struct uint128
2627
2728
} // namespace detail
2829
30+
// ----- BID Conversions -----
31+
2932
BOOST_DECIMAL_CXX20_CONSTEXPR std::uint32_t to_bid_d32(decimal32 val) noexcept;
3033
3134
BOOST_DECIMAL_CXX20_CONSTEXPR std::uint32_t to_bid_d32f(decimal32_fast val) noexcept;
@@ -48,6 +51,18 @@ BOOST_DECIMAL_CXX20_CONSTEXPR T from_bid(std::uint64_t bits) noexcept;
4851
template <typename T = decimal128>
4952
BOOST_DECIMAL_CXX20_CONSTEXPR T from_bid(detail::uint128 bits) noexcept;
5053
54+
// ----- DPD Conversions -----
55+
56+
constexpr std::uint32_t to_dpd_d32(decimal32 val) noexcept;
57+
58+
constexpr std::uint32_t to_dpd_d32f(decimal32_fast val) noexcept;
59+
60+
template <typename T>
61+
constexpr auto to_dpd(T val) noexcept;
62+
63+
template <typename T = decimal32_fast>
64+
constexpr T from_dpd(std::uint32_t bits) noexcept;
65+
5166
} // namespace decimal
5267
} // namespace boost
5368
----

0 commit comments

Comments
 (0)