summaryrefslogtreecommitdiff
path: root/boost/libs/math/test/ztest_max_digits10.cpp
blob: ab3b0195d27c8c25fb7c39da0ed8bdb7afdcf62f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

 // Copyright 2010 Paul A. Bristow
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

/* Temporary test program to discover which platforms support

numeric_limits

digits10 and

new max_digits10.

This is needed to produce or select a macro to avoid compilation failure in Boost.Test
for platforms that do not include either or both of these.

BOOST_NO_CXX11_NUMERIC_LIMITS is suitable.


[Boost C++ Libraries]

#5758: Boost.Test Floating-point comparison diagnostic output does not support radix 10.

*/

#include <boost/config.hpp>
#include <boost/version.hpp>

#include <iostream>
#include <limits>

int main()
{
   std::cout  << "Platform: " << BOOST_PLATFORM            << '\n'
        << "Compiler: " << BOOST_COMPILER            << '\n'
        << "STL     : " << BOOST_STDLIB              << '\n'
        << "Boost   : " << BOOST_VERSION/100000      << "."
                        << BOOST_VERSION/100 % 1000  << "."
                        << BOOST_VERSION % 100       << std::endl;

   int digits10 = std::numeric_limits<double>::digits10;
   int max_digits10 = std::numeric_limits<double>::max_digits10;

   std::cout << "std::numeric_limits<double>::digits10 = " << digits10 << std::endl;

   std::cout << "std::numeric_limits<double>::max_digits10 = " << max_digits10 << std::endl;


} // int main()

/*

Output:

  Description: Autorun "J:\Cpp\MathToolkit\test\Math_test\Debug\ztest_max_digits10.exe"
  Platform: Win32
  Compiler: Microsoft Visual C++ version 10.0
  STL     : Dinkumware standard library version 520
  Boost   : 1.50.0
  std::numeric_limits<double>::digits10 = 15
  std::numeric_limits<double>::max_digits10 = 17



*/