| 1 | #include <iostream>
|
|---|
| 2 | #include <boost/multiprecision/cpp_bin_float.hpp>
|
|---|
| 3 |
|
|---|
| 4 | typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<128, boost::multiprecision::backends::digit_base_2> > boost_quadfloat_t;
|
|---|
| 5 |
|
|---|
| 6 | int main(int , char** )
|
|---|
| 7 | {
|
|---|
| 8 | double x = -0.5;
|
|---|
| 9 | double y = trunc(x);
|
|---|
| 10 | boost_quadfloat_t bx = x;
|
|---|
| 11 | boost_quadfloat_t by = trunc(bx);
|
|---|
| 12 |
|
|---|
| 13 | std::cout
|
|---|
| 14 | << "double: "
|
|---|
| 15 | << "trunc(" << x << ") => " << y
|
|---|
| 16 | << ";\ncpp_bin_float: "
|
|---|
| 17 | << "trunc(" << bx << ") => " << by
|
|---|
| 18 | << "\n"
|
|---|
| 19 | ;
|
|---|
| 20 |
|
|---|
| 21 | return 0;
|
|---|
| 22 | }
|
|---|