Ticket #12209: inf_test.cpp
| File inf_test.cpp, 449 bytes (added by , 6 years ago) |
|---|
| Line | |
|---|---|
| 1 | #include <iostream> |
| 2 | #include <boost/multiprecision/cpp_bin_float.hpp> |
| 3 | |
| 4 | |
| 5 | typedef boost::multiprecision::number<boost::multiprecision::backends::cpp_bin_float<128, boost::multiprecision::backends::digit_base_2> > ext_float_t; |
| 6 | |
| 7 | int main(int, char**) { |
| 8 | ext_float_t a("1e500000000"); |
| 9 | ext_float_t neginf = (-a)*a; // -inf |
| 10 | ext_float_t x = -42; |
| 11 | |
| 12 | std::cout |
| 13 | << x << " - " << neginf << " = " << x-neginf << "\n" |
| 14 | ; |
| 15 | |
| 16 | return 0; |
| 17 | } |
