File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2024 Matt Borland
2+ // Distributed under the Boost Software License, Version 1.0.
3+ // https://www.boost.org/LICENSE_1_0.txt
4+
5+ #include < boost/decimal.hpp>
6+ #include < iostream>
7+ #include < iomanip>
8+
9+ using namespace boost ::decimal;
10+
11+ int main ()
12+ {
13+ const decimal32_fast fast_type {5 };
14+ const std::uint32_t BID_bits {to_bid (fast_type)};
15+ const std::uint32_t DPD_bits {to_dpd (fast_type)};
16+
17+ std::cout << std::hex
18+ << " BID format: " << BID_bits << ' \n '
19+ << " DPD format: " << DPD_bits << std::endl;
20+
21+ const decimal32 bid_decimal {from_bid<decimal32>(BID_bits)};
22+ const decimal32 dpd_decimal {from_dpd<decimal32>(DPD_bits)};
23+
24+ return !(bid_decimal == dpd_decimal);
25+ }
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ run test_zeta.cpp ;
148148# Run the examples too
149149run ../examples/adl.cpp ;
150150run ../examples/basic_construction.cpp ;
151+ run ../examples/bit_conversions.cpp ;
151152run ../examples/charconv.cpp ;
152153run ../examples/literals.cpp ;
153154run ../examples/rounding_mode.cpp ;
You can’t perform that action at this time.
0 commit comments