File: numeric_limits_qbk.cpp

package info (click to toggle)
boost1.62 1.62.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 686,420 kB
  • sloc: cpp: 2,609,004; xml: 972,558; ansic: 53,674; python: 32,437; sh: 8,829; asm: 3,071; cs: 2,121; makefile: 964; perl: 859; yacc: 472; php: 132; ruby: 94; f90: 55; sql: 13; csh: 6
file content (719 lines) | stat: -rw-r--r-- 29,570 bytes parent folder | download | duplicates (2)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
// Copyright Paul A. Bristow 2013

// Use, modification and distribution are subject to 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)

// Program to list all numeric_limits items for any type to a file in Quickbook format.

// C standard http://www.open-std.org/jtc1/sc22/wg11/docs/n507.pdf
// SC22/WG11 N507 DRAFT INTERNATIONAL ISO/IEC STANDARD WD 10967-1
// Information technology Language independent arithmetic Part 1: Integer and Floating point arithmetic

/* E.3 C++
The programming language C++ is defined by ISO/IEC 14882:1998, Programming languages C++ [18].
An implementation should follow all the requirements of LIA-1 unless otherwise specified by
this language binding.
*/

// http://754r.ucbtest.org/standards/754.pdf

// http://www.cesura17.net/~will/Professional/Research/Papers/retrospective.pdf

// http://www.exploringbinary.com/using-integers-to-check-a-floating-point-approximation/

// http://stackoverflow.com/questions/12466745/how-to-convert-float-to-doubleboth-stored-in-ieee-754-representation-without-loss


#ifdef _MSC_VER
#  pragma warning (disable : 4127)  // conditional expression is constant.
#  pragma warning (disable : 4100)  // unreferenced formal parameter.
#endif


#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <fstream>
#include <limits> // numeric_limits

#include <typeinfo>

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

// May need extra includes for other types, for example:
#include <boost/multiprecision/cpp_dec_float.hpp> // is decimal.
#include <boost/multiprecision/cpp_bin_float.hpp> // is binary.


// Assume that this will be run on MSVC to get the 32 or 64 bit info.
#ifdef _WIN32
  std::string bits32_64 = "32";
std::string filename = "numeric_limits_32_tables.qbk";
#else
  std::string bits32_64 = "64";
std::string filename = "numeric_limits_64_tables.qbk";
#endif

#ifdef INT32_T_MAX
  int i = INT256_T_MAX;
#endif

std::array<std::string, 16> integer_type_names =
{
"bool",
"char",
"unsigned char",
"char16_t",
"char32_t",
"short",
"unsigned short",
"int", 
"unsigned int", 
"long", 
"unsigned long",
"long long",
"unsigned long long",
"int32_t",
//"uint32_t",
"int64_t",
//"uint64_t",
"int128_t",
//"uint128_t" // Too big?
//"int256_t",
//"uint256_t"
//"int512_t"
};

std::array<std::string, 6> float_type_names =
{
  "function", "float", "double", "long double", "cpp_dec_50", "cpp_bin_128"
};
 
// Table headings for integer constants.
std::array<std::string, 8> integer_constant_heads =
{
    "type", "signed", "bound", "modulo", "round", "radix", "digits", "digits10", // "max_digits10"
};

// Table headings for integer functions.
std::array<std::string, 2> integer_function_heads =
{
  "max", // "lowest",  assumes is same for all integer types, so not worth listing.
  "min"
};

// Table headings for float constants.
std::array<std::string, 12> float_constant_heads =
{
    "type", // "signed", "exact", "bound", // "modulo",
    "round", "radix", "digits", "digits10", "max_digits10", "min_exp", "min_exp10", "max_exp", "max_exp10", "tiny", "trap"
};

// Table headings for float functions.
std::array<std::string, 10> float_function_heads =
{
  "function", "max", "lowest", "min", "eps", "round", "infinity", "NaN", "sig_NaN", "denorm_min"
};

std::string versions()
{ // Build a string of info about Boost, platform, STL, etc.
  std::stringstream mess;
  //mess << "\n" << "Program:\n\" " __FILE__  << "\"\n"; // \n is mis-interpreted!
  mess << "\n" << "Program:\n numeric_limits_qbk.cpp \n";
#ifdef __TIMESTAMP__
  mess << __TIMESTAMP__;
#endif
  mess << "\nBuildInfo:\n" "  Platform " << BOOST_PLATFORM;
  mess << "\n  Compiler " BOOST_COMPILER;
#ifdef _MSC_FULL_VER
  mess << "\n  MSVC version "<< BOOST_STRINGIZE(_MSC_FULL_VER) << ".";
#endif
  mess << "\n  STL " BOOST_STDLIB;
  mess << "\n  Boost version " << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100 << std::endl;
  return mess.str();
} // std::string versions()

template <typename T>
void out_round_style(std::ostream& os)
{ //! Send short string describing STD::round_style to stream os.
    // os << "Round style is ";
    if (std::numeric_limits<T>::round_style == std::round_indeterminate)
    {
     os << "indeterminate" ;
    }
    else if (std::numeric_limits<T>::round_style == std::round_toward_zero)
    {
      os << "to zero" ;
    }
    else if (std::numeric_limits<T>::round_style == std::round_to_nearest)
    {
      os << "to nearest" ;
    }
    else if (std::numeric_limits<T>::round_style == std::round_toward_infinity)
    {
      os << "to infin[]"; // Or << "to \u221E"  << "to infinity" ;
    }
    else if (std::numeric_limits<T>::round_style == std::round_toward_neg_infinity)
    {
      os << "to -infin[]" ;
    }
    else
    {
      os << "undefined!";
      std::cout << "std::numeric_limits<T>::round_style is undefined value!" << std::endl;
    }
    return;
} // out_round_style(std::ostream& os);

template<typename T>
void integer_constants(std::string type_name, std::ostream& os)
{ //! Output a line of table integer constant values to ostream os.
    os << "\n["
          "[" << type_name << "]" ;
    os << "[" << (std::numeric_limits<T>::is_signed ? "signed" : "unsigned") << "]" ;
    // Is always exact for integer types, so removed:
    // os << "[" << (std::numeric_limits<T>::is_exact ? "exact" : "inexact") << "]" ;
    os << "[" << (std::numeric_limits<T>::is_bounded ? "bound" : "unbounded") << "]" ;
    os << "[" << (std::numeric_limits<T>::is_modulo ? "modulo" : "no") << "]" ;
    os << "[" ; out_round_style<T>(os); os << "]" ;
    os << "[" << std::numeric_limits<T>::radix << "]" ;
    os << "[" << std::numeric_limits<T>::digits << "]" ;
    os << "[" << std::numeric_limits<T>::digits10 << "]" ;
    // Undefined for integers, so removed:
   // os << "[" << std::numeric_limits<T>::max_digits10 << "]" 
     os << "]";
} // void integer_constants


template<typename T>
void float_constants(std::string type_name, std::ostream& os)
{ //! Output a row of table values to `ostream` os.
    os << "\n["
          "[" << type_name << "]" ;
    //os << "[" << (std::numeric_limits<T>::is_signed ? "signed" : "unsigned") << "]" ;
    //os << "[" << (std::numeric_limits<T>::is_exact ? "exact" : "inexact") << "]" ;
    //os << "[" << (std::numeric_limits<T>::is_bounded ? "bound" : "no") << "]" ;
    // os << "[" << (std::numeric_limits<T>::is_modulo ? "modulo" : "no") << "]" ;
    os << "[" ; out_round_style<T>(os); os << "]" ;
    os << "[" << std::numeric_limits<T>::radix << "]" ;
    os << "[" << std::numeric_limits<T>::digits << "]" ;
    os << "[" << std::numeric_limits<T>::digits10 << "]" ;
    os << "[" << std::numeric_limits<T>::max_digits10 << "]"; 
    os << "[" << std::numeric_limits<T>::min_exponent << "]" ;
    os << "[" << std::numeric_limits<T>::min_exponent10 << "]" ;
    os << "[" << std::numeric_limits<T>::max_exponent << "]" ;
    os << "[" << std::numeric_limits<T>::max_exponent10  << "]" ;
    os << "[" << (std::numeric_limits<T>::tinyness_before ? "tiny" : "no") << "]" ;
    os << "[" << (std::numeric_limits<T>::traps ? "traps" : "no") << "]" ;
    os << "]" "\n"; // end of row.
} // void float_constants

/* Types across and two functions down.

template<typename T>
void integer_functions(std::string type_name, std::ostream& os)
{ //! Output a line of table integer function values to `ostream` os.
    os << "\n["
          "[" << type_name << "]" ;
    os << "[" << std::numeric_limits<T>::max() << "]" ;
    //os << "[" << std::numeric_limits<T>::lowest() << "]" ;  always == min for integer types,
    // so removed to save space.
    os << "[" << std::numeric_limits<T>::min() << "]" 
      "]";
} // void integer_functions

*/

// Types down and two (or three) functions across.
template<typename T>
void integer_functions(std::string type_name, std::ostream& os)
{ //! Output a line of table integer function values to `ostream` os.
    os << "\n[" // start of row.
          "[" << type_name << "]" ;
    os << "[" << std::numeric_limits<T>::max() << "]" ;
   // os << "[" << std::numeric_limits<T>::lowest() << "]" ;
    os << "[" << std::numeric_limits<T>::min() << "]" ;
    os <<  "]"; // end of row.
} // void integer_functions


template<typename T>
void float_functions(std::string type_name, std::ostream& os)
{ //! Output a line of table float-point function values to `ostream` os.
    os << "\n[" // start of row.
          "[" << type_name << "]" ;
    os << "[" << std::numeric_limits<T>::max() << "]" ;
    os << "[" << std::numeric_limits<T>::lowest() << "]" ;
    os << "[" << std::numeric_limits<T>::min() << "]" 
    os << "[" << std::numeric_limits<T>::epsilon() << "]" 
    os << "[" << std::numeric_limits<T>::round_error() << "]" 
    os << "[" << std::numeric_limits<T>::infinity() << "]" 
    os << "[" << std::numeric_limits<T>::quiet_NaN() << "]" 
    os << "[" << std::numeric_limits<T>::signaling_NaN() << "]" 
    os << "[" << std::numeric_limits<T>::denorm_min() << "]" 
      "]"; // end of row.
} // void float_functions

template<typename T>
int numeric_limits_list(std::string description)
{//!  Output numeric_limits for numeric_limits<T>, for example `numeric_limits_list<bool>()`.
  // This is not used for Quickbook format.
  // std::cout << versions()  << std::endl;

  std::cout << "\n" << description << "\n"  << std::endl; // int, int64_t rather than full long typeid(T).name().

  std::cout << "Type " << typeid(T).name() << " std::numeric_limits::<" << typeid(T).name() << ">\n"  << std::endl;
  // ull long typeid(T).name()

  if (std::numeric_limits<T>::is_specialized == false)
  {
    std::cout << "type " << typeid(T).name()  << " is not specialized for std::numeric_limits!" << std::endl;
    //return -1;
  }

  // Member constants.

  std::cout << (std::numeric_limits<T>::is_signed ? "is signed." : "unsigned.")  << std::endl;
  std::cout << (std::numeric_limits<T>::is_integer ? "is integer." : "not integer (fixed or float-point).")  << std::endl;
  std::cout << (std::numeric_limits<T>::is_exact ? "is exact." : "not exact.")  << std::endl;
  std::cout << (std::numeric_limits<T>::has_infinity ? "has infinity." : "no infinity.")  << std::endl;
  std::cout << (std::numeric_limits<T>::has_quiet_NaN ? "has quiet NaN." : "no quiet NaN.")  << std::endl;
  std::cout << (std::numeric_limits<T>::has_signaling_NaN ? "has signaling NaN." : "no signaling NaN.")  << std::endl;
  if (!std::numeric_limits<T>::is_integer)
  { // is floating_point
    std::cout << "Denorm style is " ;
    if (std::numeric_limits<T>::has_denorm == std::denorm_absent)
    {
      std::cout << "denorm_absent." << std::endl;
    }
    else if (std::numeric_limits<T>::has_denorm == std::denorm_present)
    {
      std::cout << "denorm_present." << std::endl;
    }
    else if (std::numeric_limits<T>::has_denorm == std::denorm_indeterminate)
    {
      std::cout << "denorm_indeterminate." << std::endl;
    }
    else
    {
      std::cout << "std::numeric_limits<T>::has_denorm unexpected value!" << std::endl;
    }

    std::cout << (std::numeric_limits<T>::has_denorm_loss ? "has denorm loss." : "no denorm loss.")  << std::endl;
    // true if a loss of accuracy is detected as a denormalization loss, rather than an inexact result.
      
    std::cout << "Round style is ";
    if (std::numeric_limits<T>::round_style == std::round_indeterminate)
    {
      std::cout << "round_indeterminate!" << std::endl;
    }
    else if (std::numeric_limits<T>::round_style == std::round_toward_zero)
    {
      std::cout << "round_toward_zero." << std::endl;
    }
    else if (std::numeric_limits<T>::round_style == std::round_to_nearest)
    {
      std::cout << "round_to_nearest." << std::endl;
    }
    else if (std::numeric_limits<T>::round_style == std::round_toward_infinity)
    {
      std::cout << "round_toward_infinity." << std::endl;
    }
    else if (std::numeric_limits<T>::round_style == std::round_toward_neg_infinity)
    {
      std::cout << "round_toward_neg_infinity." << std::endl;
    }
    else
    {
      std::cout << "undefined value!" << std::endl;
    }

  } // is floating_point

  std::cout << (std::numeric_limits<T>::is_iec559 ? "is IEC599." : "not IEC599.")  << std::endl;
  std::cout << (std::numeric_limits<T>::is_bounded ? "is bound." : "unbounded.")  << std::endl;
  std::cout << (std::numeric_limits<T>::is_modulo ? "is modulo." : "no modulo.")  << std::endl;
  std::cout << std::dec << "radix " << std::numeric_limits<T>::radix  << std::endl;
  std::cout << "digits " << std::numeric_limits<T>::digits  << std::endl;
  std::cout << "digits10 " << std::numeric_limits<T>::digits10  << std::endl;

  std::cout.precision(std::numeric_limits<T>::max_digits10); // Full precision for floating-point values like max, min ...

  std::cout << "max_digits10 " << std::numeric_limits<T>::max_digits10  << std::endl;
  std::cout << "min_exponent " << std::numeric_limits<T>::min_exponent  << std::endl;
  std::cout << "min_exponent10 " << std::numeric_limits<T>::min_exponent10  << std::endl;
  std::cout << "max_exponent " << std::numeric_limits<T>::max_exponent  << std::endl;
  std::cout << "max_exponent10 " << std::numeric_limits<T>::max_exponent10  << std::endl;

  std::cout << (std::numeric_limits<T>::tinyness_before ? "Can tiny values before rounding." : "no tinyness_before.")  << std::endl;
  // true if the type can detect tiny values before rounding; false if it cannot.
  std::cout << (std::numeric_limits<T>::traps ? "traps" : "no trapping.")  << std::endl;
  // Whether trapping that reports on arithmetic exceptions is implemented for a type.

  std::cout << "Member functions." << std::endl;
  // (assumes operator<< for type T is available).
  // If floating-point then hex format may not be available.

  std::cout << "max = " << std::numeric_limits<T>::max() << std::endl;
  //if (std::numeric_limits<T>::is_integer)
  //{
  //  std::cout << "    = " << std::hex << std::numeric_limits<T>::max() << std::endl;
  //}

  std::cout << "lowest = " << std::dec << std::numeric_limits<T>::lowest() << std::endl;
  //if (std::numeric_limits<T>::is_integer)
  //{
  //   std::cout << "       = " << std::hex << std::numeric_limits<T>::lowest() << std::endl;
  //}

  std::cout << "min = " << std::dec << std::numeric_limits<T>::min() << std::endl;
  //if (std::numeric_limits<T>::is_integer)
  //{
  //  std::cout << "    = " << std::hex << std::numeric_limits<T>::min() << std::endl;
  //}

  std::cout << "epsilon = " << std::dec << std::numeric_limits<T>::epsilon() << std::endl;
  //if (std::numeric_limits<T>::is_integer)
  //{
  //  std::cout << "        = " << std::hex << std::numeric_limits<T>::epsilon() << std::endl;
  //}
  // round_error is always zero for integer types.
  // round_error is usually 1/2 = (T)0.5 for floating-point types.
  // round_error is ? for fixed-point.
  std::cout << "round_error = " << std::numeric_limits<T>::round_error() << " ULP." << std::endl;

  std::cout << "infinity = " << std::dec << std::numeric_limits<T>::infinity() << std::endl;
  std::cout << "         = " << std::hex << std::numeric_limits<T>::infinity() << std::endl;

  std::cout << "quiet_NaN = " << std::dec << std::numeric_limits<T>::quiet_NaN() << std::endl;
  std::cout << "          = " << std::hex << std::numeric_limits<T>::quiet_NaN() << std::endl;

  std::cout << "signaling_NaN = " << std::dec << std::numeric_limits<T>::signaling_NaN() << std::endl;
  std::cout << "              = " << std::hex << std::numeric_limits<T>::signaling_NaN() << std::endl;

  //  Only meaningful if (std::numeric_limits<T>::has_denorm == std::denorm_present)
  // so might not bother to show if absent?
  std::cout << "denorm_min = " << std::numeric_limits<T>::denorm_min()  << std::endl;
  std::cout << "           = " << std::numeric_limits<T>::denorm_min()  << std::endl;
  return 0;
}

int main()
{


    
  try
  {
    using namespace boost::multiprecision;

    std::cout << versions() << std::endl;

    std::ofstream fout(filename, std::ios_base::out);  
    if (!fout.is_open())
    {
      std::cout << "Unable to open file " << filename << " for output.\n" << std::endl;
      return -1; // boost::EXIT_FAILURE;
    }
    fout <<
      "[/""\n"
      "Copyright 2013 Paul A. Bristow.""\n"
      "Copyright 2013 John Maddock.""\n"
      "Distributed under the Boost Software License, Version 1.0.""\n"
      "(See accompanying file LICENSE_1_0.txt or copy at""\n"
      "http://www.boost.org/LICENSE_1_0.txt).""\n"
      "]""\n"
    << std::endl;

    fout << "[section:limits"<< bits32_64 << " Numeric limits for " << bits32_64 << "-bit platform]" << std::endl;

    // Output platform version info (32 or 64).
    fout << "These tables were generated using the following program and options:\n\n"
      "[pre""\n"
      << versions() 
      << "]""\n"
      << std::endl;

    fout << "[table:integral_constants Integer types constants (`std::numeric_limits<T>::is_integer == true` && is_exact == true)" "\n"
      "[";

    for (size_t i = 0; i < integer_constant_heads.size(); i++)
    { // signed, bound, modulo ...
      fout << "[" << integer_constant_heads[i] << "]" ;
    }
    fout << "]";

    integer_constants<bool>("bool", fout);
    integer_constants<char>("char", fout);
    integer_constants<unsigned char>("unsigned char", fout);
    integer_constants<char16_t>("char16_t", fout);
    integer_constants<char32_t>("char32_t", fout);
    integer_constants<short>("short", fout);
    integer_constants<unsigned short>("unsigned short", fout);
    integer_constants<int>("int", fout);
    integer_constants<unsigned int>("unsigned", fout);
    integer_constants<long>("long", fout);
    integer_constants<unsigned long>("unsigned long", fout);
    integer_constants<long long>("long long", fout);
    integer_constants<unsigned long long>("unsigned long long", fout);
    integer_constants<int32_t>("int32_t", fout);
    integer_constants<uint32_t>("uint32_t", fout);
    integer_constants<int64_t>("int64_t", fout);
    integer_constants<uint64_t>("uint64_t", fout);
    integer_constants<int128_t>("int128_t", fout);
    integer_constants<uint128_t>("uint128_t", fout);
    integer_constants<int256_t>("int256_t", fout);
    integer_constants<uint256_t>("uint256_t", fout);
   // integer_constants<int512_t>("int512_t", fout);
    //integer_constants<uint512_t>("uint512_t", fout); // Too big?
    integer_constants<cpp_int>("cpp_int", fout);

    fout << "\n]\n\n";


    fout << "[table:integral_functions Integer types functions (`std::numeric_limits<T>::is_integer == true && std::numeric_limits<T>::min() == std::numeric_limits<T>::lowest()` )" "\n"
      "[";
    // Display types across the page, and 2 (or 3) functions as rows.

    fout << "[function]";
    for (size_t i = 0; i < integer_function_heads.size(); i++)
    {
      fout << "[" << integer_function_heads[i] << "]" ;
    }
    fout << "]"; // end of headings.
    integer_functions<bool>("bool", fout);
    //integer_functions<char>("char", fout); // Need int value not char.
    fout << "\n[" // start of row.
       "[" << "char"<< "]" ;
    fout << "[" << static_cast<int>((std::numeric_limits<char>::max)()) << "]" ;
   // fout << "[" << (std::numeric_limits<T>::lowest)() << "]" ;
    fout << "[" << static_cast<int>((std::numeric_limits<char>::min)()) << "]" ;
    fout <<  "]"; // end of row.
    //integer_functions<unsigned char>("unsigned char", fout); // Need int value not char.
    fout << "\n[" // start of row.
       "[" << "unsigned char"<< "]" ;
    fout << "[" << static_cast<int>((std::numeric_limits<unsigned char>::max)()) << "]" ;
   // fout << "[" << std::numeric_limits<unsigned char>::lowest() << "]" ;
    fout << "[" << static_cast<int>(std::numeric_limits<unsigned char>::min()) << "]" ;
    fout <<  "]"; // end of row.

    integer_functions<char16_t>("char16_t", fout);
    integer_functions<char32_t>("char32_t", fout);
    integer_functions<short>("short", fout);
    integer_functions<unsigned short>("unsigned short", fout);
    integer_functions<int>("int", fout);
    integer_functions<unsigned int>("unsigned int", fout);
    integer_functions<long>("long", fout);
    integer_functions<unsigned long>("unsigned long", fout);
    integer_functions<long long>("long long", fout);
    integer_functions<unsigned long long>("unsigned long long", fout);
    integer_functions<int32_t>("int32_t", fout);
    integer_functions<int64_t>("int64_t", fout);
    integer_functions<int128_t>("int128_t", fout);
    fout << "]" "\n";  // end of table;


    //fout << "[[max]" 
    //  << "[" << std::numeric_limits<bool>::max() << "]" 
    //  << "[" << static_cast<int>(std::numeric_limits<char>::max()) << "]" 
    //  << "[" << static_cast<int>(std::numeric_limits<unsigned char>::max()) << "]" 
    //  << "[" << static_cast<int>(std::numeric_limits<char16_t>::max()) << "]" 
    //  << "[" << static_cast<int>(std::numeric_limits<char32_t>::max()) << "]" 
    //  << "[" << std::numeric_limits<short>::max() << "]" 
    //  << "[" << std::numeric_limits<unsigned short>::max() << "]" 
    //  << "[" << std::numeric_limits<int>::max() << "]" 
    //  << "[" << std::numeric_limits<unsigned int>::max() << "]" 
    //  << "[" << std::numeric_limits<long>::max() << "]" 
    //  << "[" << std::numeric_limits<unsigned long>::max() << "]" 
    //  << "[" << std::numeric_limits<long long>::max() << "]" 
    //  << "[" << std::numeric_limits<unsigned long long>::max() << "]" 
    //  << "[" << std::numeric_limits<int32_t>::max() << "]" 
    //  << "[" << std::numeric_limits<int64_t>::max() << "]" 
    //  << "[" << std::numeric_limits<int128_t>::max() << "]" 
    //  //<< "[" << std::numeric_limits<int256_t>::max() << "]"  // too big?
    //  //<< "[" << std::numeric_limits<int512_t>::max() << "]" // too big?
    //  << "]" "\n";
    ///*  Assume lowest() is not useful as == min for all integer types.
    // */

    //fout << "[[min]"
    //  << "[" << std::numeric_limits<bool>::min() << "]" 
    //  << "[" << static_cast<int>(std::numeric_limits<char>::min()) << "]" 
    //  << "[" << static_cast<int>(std::numeric_limits<unsigned char>::min()) << "]" 
    //  << "[" << static_cast<int>(std::numeric_limits<char16_t>::min()) << "]" 
    //  << "[" << static_cast<int>(std::numeric_limits<char32_t>::min()) << "]" 
    //  << "[" << std::numeric_limits<short>::min() << "]" 
    //  << "[" << std::numeric_limits<unsigned short>::min() << "]" 
    //  << "[" << std::numeric_limits<int>::min() << "]" 
    //  << "[" << std::numeric_limits<unsigned int>::min() << "]" 
    //  << "[" << std::numeric_limits<long>::min() << "]" 
    //  << "[" << std::numeric_limits<unsigned long>::min() << "]" 
    //  << "[" << std::numeric_limits<long long>::min() << "]" 
    //  << "[" << std::numeric_limits<unsigned long long>::min() << "]" 
    //  << "[" << std::numeric_limits<int32_t>::min() << "]" 
    //  << "[" << std::numeric_limits<int64_t>::min() << "]" 
    //  << "[" << std::numeric_limits<int128_t>::min() << "]" 
    //  // << "[" << std::numeric_limits<int256_t>::min() << "]"  // too big?
    //  // << "[" << std::numeric_limits<int512_t>::min() << "]"  // too big?
    //  << "]""\n";


    
  // Floating-point
    
    typedef number<cpp_dec_float<50> > cpp_dec_float_50; // 50 decimal digits.
    typedef number<cpp_bin_float<113> > bin_128bit_double_type; // == Binary rare long double.

    fout <<
      //"[table:float_functions Floating-point types constants (`std::numeric_limits<T>::is_integer == false && std::numeric_limits<T>::is_modulo == false` )" "\n"
      "[table:float_functions Floating-point types constants (`std::numeric_limits<T>::is_integer==false && is_signed==true && is_modulo==false && is_exact==false && is_bound==true`)" "\n"
      "[";
    for (size_t i = 0; i < float_constant_heads.size(); i++)
    {
      fout << "[" << float_constant_heads[i] << "]" ;
    }
    fout << "]"; // end of headings.

    float_constants<float>("float", fout);
    float_constants<double>("double", fout);
    float_constants<long double>("long double", fout);
    float_constants<cpp_dec_float_50>("cpp_dec_float_50", fout);
    float_constants<bin_128bit_double_type>("bin_128bit_double_type", fout);
    fout << "]" "\n";  // end of table;

    fout <<
      "[table:float_functions Floating-point types functions (`std::numeric_limits<T>::is_integer == false`)" "\n"
      "[";

    for (size_t i = 0; i < float_type_names.size(); i++)
    {
      fout << "[" << float_type_names[i] << "]" ;
    }
    fout << "]"; // end of headings.

    fout << "[[max]" 
      << "[" << std::numeric_limits<float>::max() << "]" 
      << "[" << std::numeric_limits<double>::max() << "]" 
//#if LDBL_MANT_DIG > DBL_MANT_DIG
    // Perhaps to test Long double is not just a duplication of double (but need change is headings too).
      << "[" << std::numeric_limits<long double>::max() << "]" 
//#endif
      << "[" << std::numeric_limits<cpp_dec_float_50>::max() << "]" 
      << "[" << std::numeric_limits<bin_128bit_double_type >::max() << "]" 
      << "]" "\n"; // end of row.

    fout << "[[min]" 
      << "[" << std::numeric_limits<float>::min() << "]" 
      << "[" << std::numeric_limits<double>::min() << "]" 
//#if LDBL_MANT_DIG > DBL_MANT_DIG
    // Long double is not just a duplication of double.
      << "[" << std::numeric_limits<long double>::min() << "]" 
//#endif
      << "[" << std::numeric_limits<cpp_dec_float_50 >::min() << "]" 
      << "[" << std::numeric_limits<bin_128bit_double_type >::min() << "]" 
      << "]" "\n"; // end of row.

    fout << "[[epsilon]" 
      << "[" << std::numeric_limits<float>::epsilon() << "]" 
      << "[" << std::numeric_limits<double>::epsilon() << "]" 
//#if LDBL_MANT_DIG > DBL_MANT_DIG
    // Long double is not just a duplication of double.
      << "[" << std::numeric_limits<long double>::epsilon() << "]" 
//#endif
      << "[" << std::numeric_limits<cpp_dec_float_50 >::epsilon() << "]" 
      << "[" << std::numeric_limits<bin_128bit_double_type >::epsilon() << "]" 
      << "]" "\n"; // end of row.

    fout << "[[round_error]" 
      << "[" << std::numeric_limits<float>::round_error() << "]" 
      << "[" << std::numeric_limits<double>::round_error() << "]" 
//#if LDBL_MANT_DIG > DBL_MANT_DIG
    // Long double is not just a duplication of double.
      << "[" << std::numeric_limits<long double>::round_error() << "]" 
//#endif
      << "[" << std::numeric_limits<cpp_dec_float_50 >::round_error() << "]" 
      << "[" << std::numeric_limits<bin_128bit_double_type >::round_error() << "]" 
      << "]" "\n"; // end of row.

    fout << "[[infinity]" 
      << "[" << std::numeric_limits<float>::infinity() << "]" 
      << "[" << std::numeric_limits<double>::infinity() << "]" 
//#if LDBL_MANT_DIG > DBL_MANT_DIG
    // Long double is not just a duplication of double.
      << "[" << std::numeric_limits<long double>::infinity() << "]" 
//#endif
      << "[" << std::numeric_limits<cpp_dec_float_50 >::infinity() << "]" 
      << "[" << std::numeric_limits<bin_128bit_double_type >::infinity() << "]" 
      << "]" "\n"; // end of row.

    fout << "[[quiet_NaN]" 
      << "[" << std::numeric_limits<float>::quiet_NaN() << "]" 
      << "[" << std::numeric_limits<double>::quiet_NaN() << "]" 
//#if LDBL_MANT_DIG > DBL_MANT_DIG
    // Long double is not just a duplication of double.
      << "[" << std::numeric_limits<long double>::quiet_NaN() << "]" 
//#endif
      << "[" << std::numeric_limits<cpp_dec_float_50 >::quiet_NaN() << "]" 
      << "[" << std::numeric_limits<bin_128bit_double_type >::quiet_NaN() << "]" 
      << "]" "\n"; // end of row.

    fout << "[[signaling_NaN]" 
      << "[" << std::numeric_limits<float>::signaling_NaN() << "]" 
      << "[" << std::numeric_limits<double>::signaling_NaN() << "]" 
//#if LDBL_MANT_DIG > DBL_MANT_DIG
    // Long double is not just a duplication of double.
      << "[" << std::numeric_limits<long double>::signaling_NaN() << "]" 
//#endif
      << "[" << std::numeric_limits<cpp_dec_float_50 >::signaling_NaN() << "]" 
      << "[" << std::numeric_limits<bin_128bit_double_type >::signaling_NaN() << "]" 
      << "]" "\n"; // end of row.

    fout << "[[denorm_min]" 
      << "[" << std::numeric_limits<float>::denorm_min() << "]" 
      << "[" << std::numeric_limits<double>::denorm_min() << "]" 
//#if LDBL_MANT_DIG > DBL_MANT_DIG
    // Long double is not just a duplication of double.
      << "[" << std::numeric_limits<long double>::denorm_min() << "]" 
//#endif
      << "[" << std::numeric_limits<cpp_dec_float_50 >::denorm_min() << "]" 
      << "[" << std::numeric_limits<bin_128bit_double_type >::denorm_min() << "]" 
      << "]" "\n"; // end of row.



     fout << "]" "\n";  // end of table;


       fout <<  "\n\n"
    "[endsect] [/section:limits32  Numeric limits for 32-bit platform]" "\n" << std::endl;



    fout.close();
  }
  catch(std::exception ex)
  {
    std::cout << "exception thrown: " << ex.what() << std::endl;
  }


} // int main()

/*
  Description: Autorun "J:\Cpp\Misc\Debug\numeric_limits_qbk.exe" 
  
  Program: I:\boost-sandbox\multiprecision.cpp_bin_float\libs\multiprecision\doc\numeric_limits_qbk.cpp
  Wed Aug 28 14:17:21 2013
  BuildInfo:
    Platform Win32
    Compiler Microsoft Visual C++ version 10.0
    MSVC version 160040219.
    STL Dinkumware standard library version 520
    Boost version 1.55.0

  */