File tree Expand file tree Collapse file tree 2 files changed +32
-31
lines changed
Expand file tree Collapse file tree 2 files changed +32
-31
lines changed Original file line number Diff line number Diff line change @@ -112,34 +112,3 @@ constexpr T from_dpd(unsigned __int128 bits) noexcept;
112112} // namespace decimal
113113} // namespace boost
114114----
115-
116- Example
117- [source, c++]
118- ----
119- #include <boost /decimal.hpp >
120- #include <iostream >
121- #include <iomanip >
122-
123- using namespace boost::decimal;
124-
125- int main()
126- {
127- const decimal32_fast fast_type {5} ;
128- const std::uint32_t BID_bits {to_bid(fast_type)};
129- const std::uint32_t DPD_bits {to_dpd(fast_type)};
130-
131- std::cout << std::hex
132- << "BID format: " << BID_bits << '\n'
133- << "DPD format: " << DPD_bits << std::endl;
134-
135- const decimal32 bid_decimal {from_bid<decimal32>(BID_bits)};
136- const decimal32 dpd_decimal {from_dpd<decimal32>(DPD_bits)};
137-
138- return !(bid_decimal == dpd_decimal);
139- }
140- ----
141- Output:
142- ----
143- BID format: 31fc4b40
144- DPD format: 35f00000
145- ----
Original file line number Diff line number Diff line change @@ -179,3 +179,35 @@ int main()
179179 return 0;
180180}
181181----
182+
183+ == Bit Conversions
184+ [source, c++]
185+ ----
186+ #include <boost/decimal.hpp>
187+ #include <iostream>
188+ #include <iomanip>
189+
190+ using namespace boost::decimal;
191+
192+ int main()
193+ {
194+ const decimal32_fast fast_type {5};
195+ const std::uint32_t BID_bits {to_bid(fast_type)};
196+ const std::uint32_t DPD_bits {to_dpd(fast_type)};
197+
198+ std::cout << std::hex
199+ << "BID format: " << BID_bits << '\n'
200+ << "DPD format: " << DPD_bits << std::endl;
201+
202+ const decimal32 bid_decimal {from_bid<decimal32>(BID_bits)};
203+ const decimal32 dpd_decimal {from_dpd<decimal32>(DPD_bits)};
204+
205+ return !(bid_decimal == dpd_decimal);
206+ }
207+ ----
208+ Output:
209+ ----
210+ BID format: 31fc4b40
211+ DPD format: 35f00000
212+ ----
213+
You can’t perform that action at this time.
0 commit comments