]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/multiprecision/test/test_float_conversions.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / multiprecision / test / test_float_conversions.cpp
CommitLineData
7c673cae
FG
1///////////////////////////////////////////////////////////////
2// Copyright 2015 John Maddock. Distributed under the Boost
3// Software License, Version 1.0. (See accompanying file
92f5a8d4 4// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
7c673cae
FG
5//
6
7#ifdef _MSC_VER
92f5a8d4 8#define _SCL_SECURE_NO_WARNINGS
7c673cae
FG
9#endif
10
11#include <boost/detail/lightweight_test.hpp>
12#include <boost/array.hpp>
13#include "test.hpp"
14
15#include <boost/multiprecision/cpp_bin_float.hpp>
16#include <boost/math/constants/constants.hpp>
17
18int main()
19{
20 using namespace boost::multiprecision;
21
1e59de90
TL
22 static_assert((std::is_convertible<float, cpp_bin_float_single>::value), "Error check");
23 static_assert(!(std::is_convertible<double, cpp_bin_float_single>::value), "Error check");
24 static_assert(!(std::is_convertible<long double, cpp_bin_float_single>::value), "Error check");
7c673cae
FG
25
26 cpp_bin_float_single s = boost::math::constants::pi<cpp_bin_float_single>();
f67539c2 27 std::cout << s << std::endl;
7c673cae
FG
28
29 typedef number<backends::cpp_bin_float<11, backends::digit_base_2, void, boost::int8_t, -14, 15>, et_off> cpp_bin_float_half;
30
1e59de90
TL
31 static_assert(!(std::is_convertible<float, cpp_bin_float_half>::value), "Error check");
32 static_assert(!(std::is_convertible<double, cpp_bin_float_half>::value), "Error check");
33 static_assert(!(std::is_convertible<long double, cpp_bin_float_half>::value), "Error check");
b32b8144 34#ifdef BOOST_HAS_FLOAT128
1e59de90 35 static_assert(!(std::is_convertible<__float128, cpp_bin_float_half>::value), "Error check");
b32b8144 36#endif
7c673cae
FG
37
38 cpp_bin_float_half hs = boost::math::constants::pi<cpp_bin_float_half>();
f67539c2 39 std::cout << hs << std::endl;
7c673cae
FG
40
41 return boost::report_errors();
42}