Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / math / test / ztest_max_digits10.cpp
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
10 numeric_limits
11
12 digits10 and
13
14 new max_digits10.
15
16 This is needed to produce or select a macro to avoid compilation failure in Boost.Test
17 for platforms that do not include either or both of these.
18
19 BOOST_NO_NUMERIC_LIMITS_LOWEST is suitable but deprecated.
20
21
22 [Boost C++ Libraries]
23
24 #5758: Boost.Test Floating-point comparison diagnostic output does not support radix 10.
25
26 */
27
28 #include <boost/config.hpp>
29 #include <boost/version.hpp>
30
31 #include <iostream>
32 #include <limits>
33
34 int main()
35 {
36    std::cout  << "Platform: " << BOOST_PLATFORM            << '\n'
37         << "Compiler: " << BOOST_COMPILER            << '\n'
38         << "STL     : " << BOOST_STDLIB              << '\n'
39         << "Boost   : " << BOOST_VERSION/100000      << "."
40                         << BOOST_VERSION/100 % 1000  << "."
41                         << BOOST_VERSION % 100       << std::endl;
42
43    int digits10 = std::numeric_limits<double>::digits10;
44    int max_digits10 = std::numeric_limits<double>::max_digits10;
45
46    std::cout << "std::numeric_limits<double>::digits10 = " << digits10 << std::endl;
47
48    std::cout << "std::numeric_limits<double>::max_digits10 = " << max_digits10 << std::endl;
49
50
51 } // int main()
52
53 /*
54
55 Output:
56
57   Description: Autorun "J:\Cpp\MathToolkit\test\Math_test\Debug\ztest_max_digits10.exe"
58   Platform: Win32
59   Compiler: Microsoft Visual C++ version 10.0
60   STL     : Dinkumware standard library version 520
61   Boost   : 1.50.0
62   std::numeric_limits<double>::digits10 = 15
63   std::numeric_limits<double>::max_digits10 = 17
64
65
66
67 */