]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/test/zztest_max_digits10.cpp
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / boost / libs / math / test / zztest_max_digits10.cpp
CommitLineData
7c673cae
FG
1
2// Copyright 2010 Paul A. Bristow
3//
4// Distributed under the Boost Software License, Version 1.0. (See
5// accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7
8/* Temporary test program to discover which platforms support
9
10numeric_limits
11
12digits10 and
13
14new max_digits10.
15
16This is needed to produce or select a macro to avoid compilation failure in Boost.Test
17for platforms that do not include either or both of these.
18
19BOOST_NO_CXX11_NUMERIC_LIMITS is tested here.
20
21[Boost C++ Libraries]
22
23#5758: Boost.Test Floating-point comparison diagnostic output does not support radix 10.
24
25*/
26
27#include <boost/config.hpp>
28#include <boost/version.hpp>
29
30#include <iostream>
31#include <limits>
32
33int main()
34{
35 std::cout << "Platform: " << BOOST_PLATFORM << '\n'
36 << "Compiler: " << BOOST_COMPILER << '\n'
37 << "STL : " << BOOST_STDLIB << '\n'
38 << "Boost : " << BOOST_VERSION/100000 << "."
39 << BOOST_VERSION/100 % 1000 << "."
40 << BOOST_VERSION % 100 << std::endl;
41
42 int digits10 = std::numeric_limits<double>::digits10;
43 std::cout << "std::numeric_limits<double>::digits10 = " << digits10 << std::endl;
44
45#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
46 // OK to use C++11 max_digits10;
47 int max_digits10 = std::numeric_limits<double>::max_digits10;
48 std::cout << "std::numeric_limits<double>::max_digits10 = " << max_digits10 << std::endl;
49#else
50 // No support for max_digits10; so use Kahan formula instead.
51 int max_digits10 = 2 + std::numeric_limits<double>::digits * 3010/10000;
52 std::cout << "2 + std::numeric_limits<double>::digits * 3010/10000; = " <<
53 2 + std::numeric_limits<double>::digits * 3010/10000;
54#endif
55
56
57} // int main()
58
59/*
60
61Output:
62
63 Description: Autorun "J:\Cpp\MathToolkit\test\Math_test\Debug\ztest_max_digits10.exe"
64 Platform: Win32
65 Compiler: Microsoft Visual C++ version 10.0
66 STL : Dinkumware standard library version 520
67 Boost : 1.50.0
68 std::numeric_limits<double>::digits10 = 15
69 std::numeric_limits<double>::max_digits10 = 17
70
71 1> Description: Autorun "J:\Cpp\Misc\Debug\zztest_max_digits10.exe"
72 1> Platform: Win32
73 1> Compiler: Microsoft Visual C++ version 12.0
74 1> STL : Dinkumware standard library version 610
75 1> Boost : 1.55.0
76 1> std::numeric_limits<double>::digits10 = 15
77 1> std::numeric_limits<double>::max_digits10 = 17
78
79
80*/