Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. // The template and inlines for the -*- C++ -*- numeric_limits classes.
  2.  
  3. // Copyright (C) 2000-2001 Free Software Foundation, Inc.
  4. //
  5. // This file is part of the GNU ISO C++ Library.  This library is free
  6. // software; you can redistribute it and/or modify it under the
  7. // terms of the GNU General Public License as published by the
  8. // Free Software Foundation; either version 2, or (at your option)
  9. // any later version.
  10.  
  11. // This library is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. // GNU General Public License for more details.
  15.  
  16. // You should have received a copy of the GNU General Public License along
  17. // with this library; see the file COPYING.  If not, write to the Free
  18. // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  19. // USA.
  20.  
  21. // As a special exception, you may use this file as part of a free software
  22. // library without restriction.  Specifically, if other files instantiate
  23. // templates or use macros or inline functions from this file, or you compile
  24. // this file and link it with other files to produce an executable, this
  25. // file does not by itself cause the resulting executable to be covered by
  26. // the GNU General Public License.  This exception does not however
  27. // invalidate any other reasons why the executable file might be covered by
  28. // the GNU General Public License.
  29.  
  30. // Note: this is not a conforming implementation.
  31. // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
  32.  
  33. //
  34. // ISO 14882:1998
  35. // 18.2.1
  36. //
  37.  
  38. #ifndef _CPP_NUMERIC_LIMITS
  39. #define _CPP_NUMERIC_LIMITS 1
  40.  
  41. #pragma GCC system_header
  42.  
  43. #include <bits/c++config.h>
  44. #include <bits/std_cfloat.h>
  45. #include <bits/std_climits.h>
  46. #if defined( _GLIBCPP_USE_WCHAR_T)
  47. #include <bits/std_cwchar.h>
  48. #endif
  49.  
  50. namespace std {
  51.  
  52.     enum float_round_style {
  53.         round_indeterminate       = -1,
  54.         round_toward_zero         = 0,
  55.         round_to_nearest          = 1,
  56.         round_toward_infinity     = 2,
  57.         round_toward_neg_infinity = 3
  58.     };
  59.  
  60.     enum float_denorm_style {
  61.         denorm_indeterminate = -1,
  62.         denorm_absent        = 0,
  63.         denorm_present       = 1
  64.     };
  65.  
  66.     template<typename _T> struct numeric_limits {
  67.         static const bool is_specialized = false;
  68.  
  69.         static _T min() throw() { return static_cast<_T>(0); }
  70.         static _T max() throw() { return static_cast<_T>(0); }
  71.  
  72.         static const int digits = 0;
  73.         static const int digits10 = 0;
  74.         static const bool is_signed = false;
  75.         static const bool is_integer = false;
  76.         static const bool is_exact = false;
  77.         static const int radix = 0;
  78.  
  79.         static _T epsilon() throw() { return static_cast<_T>(0); }
  80.         static _T round_error() throw() { return static_cast<_T>(0); }
  81.  
  82.         static const int min_exponent = 0;
  83.         static const int min_exponent10 = 0;
  84.         static const int max_exponent = 0;
  85.         static const int max_exponent10 = 0;
  86.  
  87.         static const bool has_infinity = false;
  88.         static const bool has_quiet_NaN = false;
  89.         static const bool has_signaling_NaN = false;
  90.         static const float_denorm_style has_denorm = denorm_absent;
  91.         static const bool has_denorm_loss = false;
  92.  
  93.         static _T infinity() throw()  { return static_cast<_T>(0); }
  94.         static _T quiet_NaN() throw() { return static_cast<_T>(0); }
  95.         static _T signaling_NaN() throw() { return static_cast<_T>(0); }
  96.         static _T denorm_min() throw() { return static_cast<_T>(0); }
  97.  
  98.         static const bool is_iec559 = false;
  99.         static const bool is_bounded = false;
  100.         static const bool is_modulo = false;
  101.  
  102.         static const bool traps = false;
  103.         static const bool tinyness_before = false;
  104.         static const float_round_style round_style = round_toward_zero;
  105.     };
  106.  
  107.     template<typename _T> _T __limits_infinity();
  108.     template<typename _T> _T __limits_quiet_NaN();
  109.     template<typename _T> _T __limits_signaling_NaN();
  110.     template<typename _T> _T __limits_denorm_min();
  111.  
  112.     template<> struct numeric_limits<bool> {
  113.         static const bool is_specialized = true;
  114.  
  115.         static bool min() throw()
  116.         { return false; }
  117.         static bool max() throw()
  118.         { return true; }
  119.  
  120.         static const int digits = 1;
  121.         static const int digits10 = 0;
  122.         static const bool is_signed = false;
  123.         static const bool is_integer = true;
  124.         static const bool is_exact = true;
  125.         static const int radix = 2;
  126.         static bool epsilon() throw()
  127.         { return 0; }
  128.         static bool round_error() throw()
  129.         { return 0; }
  130.  
  131.         static const int min_exponent = 0;
  132.         static const int min_exponent10 = 0;
  133.         static const int max_exponent = 0;
  134.         static const int max_exponent10 = 0;
  135.  
  136.         static const bool has_infinity = false;
  137.         static const bool has_quiet_NaN = false;
  138.         static const bool has_signaling_NaN = false;
  139.         static const float_denorm_style has_denorm = denorm_absent;
  140.         static const bool has_denorm_loss = false;
  141.  
  142.         static bool infinity() throw()
  143.         { return static_cast<bool>(0); }
  144.         static bool quiet_NaN() throw()
  145.         { return static_cast<bool>(0); }
  146.         static bool signaling_NaN() throw()
  147.         { return static_cast<bool>(0); }
  148.         static bool denorm_min() throw()
  149.         { return static_cast<bool>(0); }
  150.  
  151.         static const bool is_iec559 = false;
  152.         static const bool is_bounded = true;
  153.         static const bool is_modulo = false;
  154.  
  155.         static const bool traps = false;
  156.         static const bool tinyness_before = false;
  157.         static const float_round_style round_style = round_toward_zero;
  158.     };
  159.  
  160.     template<> struct numeric_limits<char> {
  161.         static const bool is_specialized = true;
  162.  
  163.         static char min() throw()
  164.         { return CHAR_MIN; }
  165.         static char max() throw()
  166.         { return CHAR_MAX; }
  167.  
  168.         static const int digits = 7;
  169.         static const int digits10 = 2;
  170.         static const bool is_signed = true;
  171.         static const bool is_integer = true;
  172.         static const bool is_exact = true;
  173.         static const int radix = 2;
  174.         static char epsilon() throw()
  175.         { return 0; }
  176.         static char round_error() throw()
  177.         { return 0; }
  178.  
  179.         static const int min_exponent = 0;
  180.         static const int min_exponent10 = 0;
  181.         static const int max_exponent = 0;
  182.         static const int max_exponent10 = 0;
  183.  
  184.         static const bool has_infinity = false;
  185.         static const bool has_quiet_NaN = false;
  186.         static const bool has_signaling_NaN = false;
  187.         static const float_denorm_style has_denorm = denorm_absent;
  188.         static const bool has_denorm_loss = false;
  189.  
  190.         static char infinity() throw()
  191.         { return static_cast<char>(0); }
  192.         static char quiet_NaN() throw()
  193.         { return static_cast<char>(0); }
  194.         static char signaling_NaN() throw()
  195.         { return static_cast<char>(0); }
  196.         static char denorm_min() throw()
  197.         { return static_cast<char>(0); }
  198.  
  199.         static const bool is_iec559 = false;
  200.         static const bool is_bounded = true;
  201.         static const bool is_modulo = false;
  202.  
  203.         static const bool traps = false;
  204.         static const bool tinyness_before = false;
  205.         static const float_round_style round_style = round_toward_zero;
  206.     };
  207.  
  208.     template<> struct numeric_limits<signed char> {
  209.         static const bool is_specialized = true;
  210.  
  211.         static signed char min() throw()
  212.         { return SCHAR_MIN; }
  213.         static signed char max() throw()
  214.         { return SCHAR_MAX; }
  215.  
  216.         static const int digits = 7;
  217.         static const int digits10 = 2;
  218.         static const bool is_signed = true;
  219.         static const bool is_integer = true;
  220.         static const bool is_exact = true;
  221.         static const int radix = 2;
  222.         static signed char epsilon() throw()
  223.         { return 0; }
  224.         static signed char round_error() throw()
  225.         { return 0; }
  226.  
  227.         static const int min_exponent = 0;
  228.         static const int min_exponent10 = 0;
  229.         static const int max_exponent = 0;
  230.         static const int max_exponent10 = 0;
  231.  
  232.         static const bool has_infinity = false;
  233.         static const bool has_quiet_NaN = false;
  234.         static const bool has_signaling_NaN = false;
  235.         static const float_denorm_style has_denorm = denorm_absent;
  236.         static const bool has_denorm_loss = false;
  237.  
  238.         static signed char infinity() throw()
  239.         { return static_cast<signed char>(0); }
  240.         static signed char quiet_NaN() throw()
  241.         { return static_cast<signed char>(0); }
  242.         static signed char signaling_NaN() throw()
  243.         { return static_cast<signed char>(0); }
  244.         static signed char denorm_min() throw()
  245.         { return static_cast<signed char>(0); }
  246.  
  247.         static const bool is_iec559 = false;
  248.         static const bool is_bounded = true;
  249.         static const bool is_modulo = false;
  250.  
  251.         static const bool traps = false;
  252.         static const bool tinyness_before = false;
  253.         static const float_round_style round_style = round_toward_zero;
  254.     };
  255.  
  256.     template<> struct numeric_limits<unsigned char> {
  257.         static const bool is_specialized = true;
  258.  
  259.         static unsigned char min() throw()
  260.         { return 0; }
  261.         static unsigned char max() throw()
  262.         { return UCHAR_MAX; }
  263.  
  264.         static const int digits = 8;
  265.         static const int digits10 = 2;
  266.         static const bool is_signed = false;
  267.         static const bool is_integer = true;
  268.         static const bool is_exact = true;
  269.         static const int radix = 2;
  270.         static unsigned char epsilon() throw()
  271.         { return 0; }
  272.         static unsigned char round_error() throw()
  273.         { return 0; }
  274.  
  275.         static const int min_exponent = 0;
  276.         static const int min_exponent10 = 0;
  277.         static const int max_exponent = 0;
  278.         static const int max_exponent10 = 0;
  279.  
  280.         static const bool has_infinity = false;
  281.         static const bool has_quiet_NaN = false;
  282.         static const bool has_signaling_NaN = false;
  283.         static const float_denorm_style has_denorm = denorm_absent;
  284.         static const bool has_denorm_loss = false;
  285.  
  286.         static unsigned char infinity() throw()
  287.         { return static_cast<unsigned char>(0); }
  288.         static unsigned char quiet_NaN() throw()
  289.         { return static_cast<unsigned char>(0); }
  290.         static unsigned char signaling_NaN() throw()
  291.         { return static_cast<unsigned char>(0); }
  292.         static unsigned char denorm_min() throw()
  293.         { return static_cast<unsigned char>(0); }
  294.  
  295.         static const bool is_iec559 = false;
  296.         static const bool is_bounded = true;
  297.         static const bool is_modulo = true;
  298.  
  299.         static const bool traps = true;
  300.         static const bool tinyness_before = false;
  301.         static const float_round_style round_style = round_toward_zero;
  302.     };
  303.  
  304. #if defined( _GLIBCPP_USE_WCHAR_T)
  305.     template<> struct numeric_limits<wchar_t> {
  306.         static const bool is_specialized = true;
  307.  
  308.         static wchar_t min() throw()
  309.         { return WCHAR_MIN; }
  310.         static wchar_t max() throw()
  311.         { return WCHAR_MAX; }
  312.  
  313.         static const int digits = 31;
  314.         static const int digits10 = 9;
  315.         static const bool is_signed = true;
  316.         static const bool is_integer = true;
  317.         static const bool is_exact = true;
  318.         static const int radix = 2;
  319.         static wchar_t epsilon() throw()
  320.         { return 0; }
  321.         static wchar_t round_error() throw()
  322.         { return 0; }
  323.  
  324.         static const int min_exponent = 0;
  325.         static const int min_exponent10 = 0;
  326.         static const int max_exponent = 0;
  327.         static const int max_exponent10 = 0;
  328.  
  329.         static const bool has_infinity = false;
  330.         static const bool has_quiet_NaN = false;
  331.         static const bool has_signaling_NaN = false;
  332.         static const float_denorm_style has_denorm = denorm_absent;
  333.         static const bool has_denorm_loss = false;
  334.  
  335.         static wchar_t infinity() throw()
  336.         { return static_cast<wchar_t>(0); }
  337.         static wchar_t quiet_NaN() throw()
  338.         { return static_cast<wchar_t>(0); }
  339.         static wchar_t signaling_NaN() throw()
  340.         { return static_cast<wchar_t>(0); }
  341.         static wchar_t denorm_min() throw()
  342.         { return static_cast<wchar_t>(0); }
  343.  
  344.         static const bool is_iec559 = false;
  345.         static const bool is_bounded = true;
  346.         static const bool is_modulo = false;
  347.  
  348.         static const bool traps = false;
  349.         static const bool tinyness_before = false;
  350.         static const float_round_style round_style = round_toward_zero;
  351.     };
  352. #endif
  353.  
  354.     template<> struct numeric_limits<short> {
  355.         static const bool is_specialized = true;
  356.  
  357.         static short min() throw()
  358.         { return SHRT_MIN; }
  359.         static short max() throw()
  360.         { return SHRT_MAX; }
  361.  
  362.         static const int digits = 15;
  363.         static const int digits10 = 4;
  364.         static const bool is_signed = true;
  365.         static const bool is_integer = true;
  366.         static const bool is_exact = true;
  367.         static const int radix = 2;
  368.         static short epsilon() throw()
  369.         { return 0; }
  370.         static short round_error() throw()
  371.         { return 0; }
  372.  
  373.         static const int min_exponent = 0;
  374.         static const int min_exponent10 = 0;
  375.         static const int max_exponent = 0;
  376.         static const int max_exponent10 = 0;
  377.  
  378.         static const bool has_infinity = false;
  379.         static const bool has_quiet_NaN = false;
  380.         static const bool has_signaling_NaN = false;
  381.         static const float_denorm_style has_denorm = denorm_absent;
  382.         static const bool has_denorm_loss = false;
  383.  
  384.         static short infinity() throw()
  385.         { return static_cast<short>(0); }
  386.         static short quiet_NaN() throw()
  387.         { return static_cast<short>(0); }
  388.         static short signaling_NaN() throw()
  389.         { return static_cast<short>(0); }
  390.         static short denorm_min() throw()
  391.         { return static_cast<short>(0); }
  392.  
  393.         static const bool is_iec559 = false;
  394.         static const bool is_bounded = true;
  395.         static const bool is_modulo = false;
  396.  
  397.         static const bool traps = false;
  398.         static const bool tinyness_before = false;
  399.         static const float_round_style round_style = round_toward_zero;
  400.     };
  401.  
  402.     template<> struct numeric_limits<unsigned short> {
  403.         static const bool is_specialized = true;
  404.  
  405.         static unsigned short min() throw()
  406.         { return 0; }
  407.         static unsigned short max() throw()
  408.         { return USHRT_MAX; }
  409.  
  410.         static const int digits = 16;
  411.         static const int digits10 = 4;
  412.         static const bool is_signed = false;
  413.         static const bool is_integer = true;
  414.         static const bool is_exact = true;
  415.         static const int radix = 2;
  416.         static unsigned short epsilon() throw()
  417.         { return 0; }
  418.         static unsigned short round_error() throw()
  419.         { return 0; }
  420.  
  421.         static const int min_exponent = 0;
  422.         static const int min_exponent10 = 0;
  423.         static const int max_exponent = 0;
  424.         static const int max_exponent10 = 0;
  425.  
  426.         static const bool has_infinity = false;
  427.         static const bool has_quiet_NaN = false;
  428.         static const bool has_signaling_NaN = false;
  429.         static const float_denorm_style has_denorm = denorm_absent;
  430.         static const bool has_denorm_loss = false;
  431.  
  432.         static unsigned short infinity() throw()
  433.         { return static_cast<unsigned short>(0); }
  434.         static unsigned short quiet_NaN() throw()
  435.         { return static_cast<unsigned short>(0); }
  436.         static unsigned short signaling_NaN() throw()
  437.         { return static_cast<unsigned short>(0); }
  438.         static unsigned short denorm_min() throw()
  439.         { return static_cast<unsigned short>(0); }
  440.  
  441.         static const bool is_iec559 = false;
  442.         static const bool is_bounded = true;
  443.         static const bool is_modulo = true;
  444.  
  445.         static const bool traps = true;
  446.         static const bool tinyness_before = false;
  447.         static const float_round_style round_style = round_toward_zero;
  448.     };
  449.  
  450.     template<> struct numeric_limits<int> {
  451.         static const bool is_specialized = true;
  452.  
  453.         static int min() throw()
  454.         { return INT_MIN; }
  455.         static int max() throw()
  456.         { return INT_MAX; }
  457.  
  458.         static const int digits = 31;
  459.         static const int digits10 = 9;
  460.         static const bool is_signed = true;
  461.         static const bool is_integer = true;
  462.         static const bool is_exact = true;
  463.         static const int radix = 2;
  464.         static int epsilon() throw()
  465.         { return 0; }
  466.         static int round_error() throw()
  467.         { return 0; }
  468.  
  469.         static const int min_exponent = 0;
  470.         static const int min_exponent10 = 0;
  471.         static const int max_exponent = 0;
  472.         static const int max_exponent10 = 0;
  473.  
  474.         static const bool has_infinity = false;
  475.         static const bool has_quiet_NaN = false;
  476.         static const bool has_signaling_NaN = false;
  477.         static const float_denorm_style has_denorm = denorm_absent;
  478.         static const bool has_denorm_loss = false;
  479.  
  480.         static int infinity() throw()
  481.         { return static_cast<int>(0); }
  482.         static int quiet_NaN() throw()
  483.         { return static_cast<int>(0); }
  484.         static int signaling_NaN() throw()
  485.         { return static_cast<int>(0); }
  486.         static int denorm_min() throw()
  487.         { return static_cast<int>(0); }
  488.  
  489.         static const bool is_iec559 = true;
  490.         static const bool is_bounded = true;
  491.         static const bool is_modulo = false;
  492.  
  493.         static const bool traps = false;
  494.         static const bool tinyness_before = false;
  495.         static const float_round_style round_style = round_toward_zero;
  496.     };
  497.  
  498.     template<> struct numeric_limits<unsigned int> {
  499.         static const bool is_specialized = true;
  500.  
  501.         static unsigned int min() throw()
  502.         { return 0; }
  503.         static unsigned int max() throw()
  504.         { return UINT_MAX; }
  505.  
  506.         static const int digits = 32;
  507.         static const int digits10 = 9;
  508.         static const bool is_signed = false;
  509.         static const bool is_integer = true;
  510.         static const bool is_exact = true;
  511.         static const int radix = 2;
  512.         static unsigned int epsilon() throw()
  513.         { return 0; }
  514.         static unsigned int round_error() throw()
  515.         { return 0; }
  516.  
  517.         static const int min_exponent = 0;
  518.         static const int min_exponent10 = 0;
  519.         static const int max_exponent = 0;
  520.         static const int max_exponent10 = 0;
  521.  
  522.         static const bool has_infinity = false;
  523.         static const bool has_quiet_NaN = false;
  524.         static const bool has_signaling_NaN = false;
  525.         static const float_denorm_style has_denorm = denorm_absent;
  526.         static const bool has_denorm_loss = false;
  527.  
  528.         static unsigned int infinity() throw()
  529.         { return static_cast<unsigned int>(0); }
  530.         static unsigned int quiet_NaN() throw()
  531.         { return static_cast<unsigned int>(0); }
  532.         static unsigned int signaling_NaN() throw()
  533.         { return static_cast<unsigned int>(0); }
  534.         static unsigned int denorm_min() throw()
  535.         { return static_cast<unsigned int>(0); }
  536.  
  537.         static const bool is_iec559 = true;
  538.         static const bool is_bounded = true;
  539.         static const bool is_modulo = true;
  540.  
  541.         static const bool traps = true;
  542.         static const bool tinyness_before = false;
  543.         static const float_round_style round_style = round_toward_zero;
  544.     };
  545.  
  546.     template<> struct numeric_limits<long> {
  547.         static const bool is_specialized = true;
  548.  
  549.         static long min() throw()
  550.         { return LONG_MIN; }
  551.         static long max() throw()
  552.         { return LONG_MAX; }
  553.  
  554.         static const int digits = 31;
  555.         static const int digits10 = 9;
  556.         static const bool is_signed = true;
  557.         static const bool is_integer = true;
  558.         static const bool is_exact = true;
  559.         static const int radix = 2;
  560.         static long epsilon() throw()
  561.         { return 0; }
  562.         static long round_error() throw()
  563.         { return 0; }
  564.  
  565.         static const int min_exponent = 0;
  566.         static const int min_exponent10 = 0;
  567.         static const int max_exponent = 0;
  568.         static const int max_exponent10 = 0;
  569.  
  570.         static const bool has_infinity = false;
  571.         static const bool has_quiet_NaN = false;
  572.         static const bool has_signaling_NaN = false;
  573.         static const float_denorm_style has_denorm = denorm_absent;
  574.         static const bool has_denorm_loss = false;
  575.  
  576.         static long infinity() throw()
  577.         { return static_cast<long>(0); }
  578.         static long quiet_NaN() throw()
  579.         { return static_cast<long>(0); }
  580.         static long signaling_NaN() throw()
  581.         { return static_cast<long>(0); }
  582.         static long denorm_min() throw()
  583.         { return static_cast<long>(0); }
  584.  
  585.         static const bool is_iec559 = true;
  586.         static const bool is_bounded = true;
  587.         static const bool is_modulo = false;
  588.  
  589.         static const bool traps = false;
  590.         static const bool tinyness_before = false;
  591.         static const float_round_style round_style = round_toward_zero;
  592.     };
  593.  
  594.     template<> struct numeric_limits<unsigned long> {
  595.         static const bool is_specialized = true;
  596.  
  597.         static unsigned long min() throw()
  598.         { return 0; }
  599.         static unsigned long max() throw()
  600.         { return ULONG_MAX; }
  601.  
  602.         static const int digits = 32;
  603.         static const int digits10 = 9;
  604.         static const bool is_signed = false;
  605.         static const bool is_integer = true;
  606.         static const bool is_exact = true;
  607.         static const int radix = 2;
  608.         static unsigned long epsilon() throw()
  609.         { return 0; }
  610.         static unsigned long round_error() throw()
  611.         { return 0; }
  612.  
  613.         static const int min_exponent = 0;
  614.         static const int min_exponent10 = 0;
  615.         static const int max_exponent = 0;
  616.         static const int max_exponent10 = 0;
  617.  
  618.         static const bool has_infinity = false;
  619.         static const bool has_quiet_NaN = false;
  620.         static const bool has_signaling_NaN = false;
  621.         static const float_denorm_style has_denorm = denorm_absent;
  622.         static const bool has_denorm_loss = false;
  623.  
  624.         static unsigned long infinity() throw()
  625.         { return static_cast<unsigned long>(0); }
  626.         static unsigned long quiet_NaN() throw()
  627.         { return static_cast<unsigned long>(0); }
  628.         static unsigned long signaling_NaN() throw()
  629.         { return static_cast<unsigned long>(0); }
  630.         static unsigned long denorm_min() throw()
  631.         { return static_cast<unsigned long>(0); }
  632.  
  633.         static const bool is_iec559 = true;
  634.         static const bool is_bounded = true;
  635.         static const bool is_modulo = true;
  636.  
  637.         static const bool traps = true;
  638.         static const bool tinyness_before = false;
  639.         static const float_round_style round_style = round_toward_zero;
  640.     };
  641.  
  642.     template<> struct numeric_limits<float> {
  643.         static const bool is_specialized = true;
  644.  
  645.         static float min() throw()
  646.         { return FLT_MIN; }
  647.         static float max() throw()
  648.         { return FLT_MAX; }
  649.  
  650.         static const int digits = FLT_MANT_DIG;
  651.         static const int digits10 = FLT_DIG;
  652.         static const bool is_signed = true;
  653.         static const bool is_integer = false;
  654.         static const bool is_exact = false;
  655.         static const int radix = FLT_RADIX;
  656.         static float epsilon() throw()
  657.         { return FLT_EPSILON; }
  658.         static float round_error() throw()
  659.         { return FLT_ROUNDS; }
  660.  
  661.         static const int min_exponent = FLT_MIN_EXP;
  662.         static const int min_exponent10 = FLT_MIN_10_EXP;
  663.         static const int max_exponent = FLT_MAX_EXP;
  664.         static const int max_exponent10 = FLT_MAX_10_EXP;
  665.  
  666.         static const bool has_infinity = false;
  667.         static const bool has_quiet_NaN = false;
  668.         static const bool has_signaling_NaN = false;
  669.         static const float_denorm_style has_denorm = denorm_absent;
  670.         static const bool has_denorm_loss = false;
  671.  
  672.         static float infinity() throw()
  673.         { return static_cast<float>(0); }
  674.         static float quiet_NaN() throw()
  675.         { return static_cast<float>(0); }
  676.         static float signaling_NaN() throw()
  677.         { return static_cast<float>(0); }
  678.         static float denorm_min() throw()
  679.         { return static_cast<float>(0); }
  680.  
  681.         static const bool is_iec559 = false;
  682.         static const bool is_bounded = true;
  683.         static const bool is_modulo = false;
  684.  
  685.         static const bool traps = false;
  686.         static const bool tinyness_before = false;
  687.         static const float_round_style round_style = round_toward_zero;
  688.     };
  689.  
  690.     template<> struct numeric_limits<double> {
  691.         static const bool is_specialized = true;
  692.  
  693.         static double min() throw()
  694.         { return DBL_MIN; }
  695.         static double max() throw()
  696.         { return DBL_MAX; }
  697.  
  698.         static const int digits = DBL_MANT_DIG;
  699.         static const int digits10 = DBL_DIG;
  700.         static const bool is_signed = true;
  701.         static const bool is_integer = false;
  702.         static const bool is_exact = false;
  703.         static const int radix = 2;
  704.         static double epsilon() throw()
  705.         { return DBL_EPSILON; }
  706.         static double round_error() throw()
  707.         { return 1.0; }
  708.  
  709.         static const int min_exponent = DBL_MIN_EXP;
  710.         static const int min_exponent10 = DBL_MIN_10_EXP;
  711.         static const int max_exponent = DBL_MAX_EXP;
  712.         static const int max_exponent10 = DBL_MAX_10_EXP;
  713.  
  714.         static const bool has_infinity = false;
  715.         static const bool has_quiet_NaN = false;
  716.         static const bool has_signaling_NaN = false;
  717.         static const float_denorm_style has_denorm = denorm_absent;
  718.         static const bool has_denorm_loss = false;
  719.  
  720.         static double infinity() throw()
  721.         { return static_cast<double>(0); }
  722.         static double quiet_NaN() throw()
  723.         { return static_cast<double>(0); }
  724.         static double signaling_NaN() throw()
  725.         { return static_cast<double>(0); }
  726.         static double denorm_min() throw()
  727.         { return static_cast<double>(0); }
  728.  
  729.         static const bool is_iec559 = false;
  730.         static const bool is_bounded = true;
  731.         static const bool is_modulo = false;
  732.  
  733.         static const bool traps = false;
  734.         static const bool tinyness_before = false;
  735.         static const float_round_style round_style = round_toward_zero;
  736.     };
  737.  
  738.     template<> struct numeric_limits<long double> {
  739.         static const bool is_specialized = true;
  740.  
  741.         static double min() throw()
  742.         { return LDBL_MIN; }
  743.         static double max() throw()
  744.         { return LDBL_MAX; }
  745.  
  746.         static const int digits = LDBL_MANT_DIG;
  747.         static const int digits10 = LDBL_DIG;
  748.         static const bool is_signed = true;
  749.         static const bool is_integer = false;
  750.         static const bool is_exact = false;
  751.         static const int radix = 2;
  752.         static double epsilon() throw()
  753.         { return LDBL_EPSILON; }
  754.         static double round_error() throw()
  755.         { return 1.0L; }
  756.  
  757.         static const int min_exponent = LDBL_MIN_EXP;
  758.         static const int min_exponent10 = LDBL_MIN_10_EXP;
  759.         static const int max_exponent = LDBL_MAX_EXP;
  760.         static const int max_exponent10 = LDBL_MAX_10_EXP;
  761.  
  762.         static const bool has_infinity = false;
  763.         static const bool has_quiet_NaN = false;
  764.         static const bool has_signaling_NaN = false;
  765.         static const float_denorm_style has_denorm = denorm_absent;
  766.         static const bool has_denorm_loss = false;
  767.  
  768.         static double infinity() throw()
  769.         { return static_cast<double>(0); }
  770.         static double quiet_NaN() throw()
  771.         { return static_cast<double>(0); }
  772.         static double signaling_NaN() throw()
  773.         { return static_cast<double>(0); }
  774.         static double denorm_min() throw()
  775.         { return static_cast<double>(0); }
  776.  
  777.         static const bool is_iec559 = false;
  778.         static const bool is_bounded = true;
  779.         static const bool is_modulo = false;
  780.  
  781.         static const bool traps = false;
  782.         static const bool tinyness_before = false;
  783.         static const float_round_style round_style = round_toward_zero;
  784.     };
  785.  
  786. } // namespace std
  787.  
  788. #endif // _CPP_NUMERIC_LIMITS
  789.