]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/multiprecision/test/git_issue_313.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / multiprecision / test / git_issue_313.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright 2021 Christopher Kormanyos. Distributed under the Boost
3 // Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #include <iomanip>
7 #include <sstream>
8
9 #include <boost/multiprecision/cpp_dec_float.hpp>
10
11 #include "test.hpp"
12
13 void test()
14 {
15 using local_decfloat_type = boost::multiprecision::cpp_dec_float_100;
16
17 bool result0_is_ok = false;
18 bool result1_is_ok = false;
19
20 {
21 const local_decfloat_type test = pow(local_decfloat_type{2}, 30) * pow(local_decfloat_type{10}, -3);
22
23 std::stringstream strm;
24
25 strm << std::setprecision(std::numeric_limits<local_decfloat_type>::digits10)
26 << std::fixed
27 << test;
28
29 result0_is_ok =
30 (strm.str() == "1073741.8240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
31 }
32
33 {
34 const local_decfloat_type test(0.625F);
35
36 std::stringstream strm;
37
38 strm << std::setprecision(std::numeric_limits<local_decfloat_type>::digits10)
39 << std::fixed
40 << test;
41
42 result1_is_ok =
43 (strm.str() == "0.6250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
44 }
45
46 const bool result_is_ok = (result0_is_ok && result1_is_ok);
47
48 BOOST_CHECK_EQUAL(result_is_ok, true);
49 }
50
51 int main()
52 {
53 test();
54
55 return boost::report_errors();
56 }