File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2025 Matt Borland
2+ // Distributed under the Boost Software License, Version 1.0.
3+ // https://www.boost.org/LICENSE_1_0.txt
4+ //
5+ // This example, when run with the pretty printers, shows how various values are represented
6+
7+ #include < boost/decimal/decimal32_t.hpp> // For type decimal32_t
8+ #include < boost/decimal/cmath.hpp> // For nan function to write payload to nans
9+ #include < limits>
10+
11+ int main ()
12+ {
13+ using boost::decimal::decimal32_t ;
14+
15+ const decimal32_t max {std::numeric_limits<decimal32_t >::max ()};
16+ const decimal32_t min {std::numeric_limits<decimal32_t >::min ()};
17+ const decimal32_t short_num {" 3.14" };
18+ const decimal32_t pos_inf {std::numeric_limits<decimal32_t >::infinity ()};
19+ const decimal32_t neg_inf {-std::numeric_limits<decimal32_t >::infinity ()};
20+
21+ const decimal32_t qnan {std::numeric_limits<decimal32_t >::quiet_NaN ()};
22+ const decimal32_t snan {std::numeric_limits<decimal32_t >::signaling_NaN ()};
23+
24+ const decimal32_t payload_nan {boost::decimal::nand32 (" 7" )};
25+
26+ // Break Here:
27+ static_cast <void >(max);
28+ static_cast <void >(min);
29+ static_cast <void >(short_num);
30+ static_cast <void >(pos_inf);
31+ static_cast <void >(neg_inf);
32+ static_cast <void >(qnan);
33+ static_cast <void >(snan);
34+ static_cast <void >(payload_nan);
35+
36+ return 0 ;
37+ }
Original file line number Diff line number Diff line change @@ -214,6 +214,7 @@ run ../examples/first_example.cpp ;
214214run ../examples/basic_arithmetic.cpp ;
215215run ../examples/to_from_file.cpp ;
216216run ../examples/addition.cpp ;
217+ run ../examples/debugger.cpp ;
217218
218219# Test compilation of separate headers
219220compile compile_tests/bid_conversion.cpp ;
You can’t perform that action at this time.
0 commit comments