Whole document tree limits_generic.hGo to the documentation of this file.00001 // The template and inlines for the -*- C++ -*- numeric_limits classes. 00002 00003 // Copyright (C) 2000-2001 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 2, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // You should have received a copy of the GNU General Public License along 00017 // with this library; see the file COPYING. If not, write to the Free 00018 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00019 // USA. 00020 00021 // As a special exception, you may use this file as part of a free software 00022 // library without restriction. Specifically, if other files instantiate 00023 // templates or use macros or inline functions from this file, or you compile 00024 // this file and link it with other files to produce an executable, this 00025 // file does not by itself cause the resulting executable to be covered by 00026 // the GNU General Public License. This exception does not however 00027 // invalidate any other reasons why the executable file might be covered by 00028 // the GNU General Public License. 00029 00030 // Note: this is not a conforming implementation. 00031 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr> 00032 00033 // 00034 // ISO 14882:1998 00035 // 18.2.1 00036 // 00037 00043 #ifndef _CPP_NUMERIC_LIMITS 00044 #define _CPP_NUMERIC_LIMITS 1 00045 00046 #pragma GCC system_header 00047 00048 #include <bits/c++config.h> 00049 #include <bits/std_cfloat.h> 00050 #include <bits/std_climits.h> 00051 #if defined( _GLIBCPP_USE_WCHAR_T) 00052 #include <bits/std_cwchar.h> 00053 #endif 00054 00055 namespace std { 00056 00058 enum float_round_style { 00059 round_indeterminate = -1, 00060 round_toward_zero = 0, 00061 round_to_nearest = 1, 00062 round_toward_infinity = 2, 00063 round_toward_neg_infinity = 3 00064 }; 00065 00067 enum float_denorm_style { 00068 denorm_indeterminate = -1, 00069 denorm_absent = 0, 00070 denorm_present = 1 00071 }; 00072 00080 template<typename _T> struct numeric_limits { 00081 static const bool is_specialized = false; 00082 00083 static _T min() throw() { return static_cast<_T>(0); } 00084 static _T max() throw() { return static_cast<_T>(0); } 00085 00086 static const int digits = 0; 00087 static const int digits10 = 0; 00088 static const bool is_signed = false; 00089 static const bool is_integer = false; 00090 static const bool is_exact = false; 00091 static const int radix = 0; 00092 00093 static _T epsilon() throw() { return static_cast<_T>(0); } 00094 static _T round_error() throw() { return static_cast<_T>(0); } 00095 00096 static const int min_exponent = 0; 00097 static const int min_exponent10 = 0; 00098 static const int max_exponent = 0; 00099 static const int max_exponent10 = 0; 00100 00101 static const bool has_infinity = false; 00102 static const bool has_quiet_NaN = false; 00103 static const bool has_signaling_NaN = false; 00104 static const float_denorm_style has_denorm = denorm_absent; 00105 static const bool has_denorm_loss = false; 00106 00107 static _T infinity() throw() { return static_cast<_T>(0); } 00108 static _T quiet_NaN() throw() { return static_cast<_T>(0); } 00109 static _T signaling_NaN() throw() { return static_cast<_T>(0); } 00110 static _T denorm_min() throw() { return static_cast<_T>(0); } 00111 00112 static const bool is_iec559 = false; 00113 static const bool is_bounded = false; 00114 static const bool is_modulo = false; 00115 00116 static const bool traps = false; 00117 static const bool tinyness_before = false; 00118 static const float_round_style round_style = round_toward_zero; 00119 }; 00120 00121 template<typename _T> _T __limits_infinity(); 00122 template<typename _T> _T __limits_quiet_NaN(); 00123 template<typename _T> _T __limits_signaling_NaN(); 00124 template<typename _T> _T __limits_denorm_min(); 00125 00126 template<> struct numeric_limits<bool> { 00127 static const bool is_specialized = true; 00128 00129 static bool min() throw() 00130 { return false; } 00131 static bool max() throw() 00132 { return true; } 00133 00134 static const int digits = 1; 00135 static const int digits10 = 0; 00136 static const bool is_signed = false; 00137 static const bool is_integer = true; 00138 static const bool is_exact = true; 00139 static const int radix = 2; 00140 static bool epsilon() throw() 00141 { return 0; } 00142 static bool round_error() throw() 00143 { return 0; } 00144 00145 static const int min_exponent = 0; 00146 static const int min_exponent10 = 0; 00147 static const int max_exponent = 0; 00148 static const int max_exponent10 = 0; 00149 00150 static const bool has_infinity = false; 00151 static const bool has_quiet_NaN = false; 00152 static const bool has_signaling_NaN = false; 00153 static const float_denorm_style has_denorm = denorm_absent; 00154 static const bool has_denorm_loss = false; 00155 00156 static bool infinity() throw() 00157 { return static_cast<bool>(0); } 00158 static bool quiet_NaN() throw() 00159 { return static_cast<bool>(0); } 00160 static bool signaling_NaN() throw() 00161 { return static_cast<bool>(0); } 00162 static bool denorm_min() throw() 00163 { return static_cast<bool>(0); } 00164 00165 static const bool is_iec559 = false; 00166 static const bool is_bounded = true; 00167 static const bool is_modulo = false; 00168 00169 static const bool traps = false; 00170 static const bool tinyness_before = false; 00171 static const float_round_style round_style = round_toward_zero; 00172 }; 00173 00174 template<> struct numeric_limits<char> { 00175 static const bool is_specialized = true; 00176 00177 static char min() throw() 00178 { return CHAR_MIN; } 00179 static char max() throw() 00180 { return CHAR_MAX; } 00181 00182 static const int digits = 7; 00183 static const int digits10 = 2; 00184 static const bool is_signed = true; 00185 static const bool is_integer = true; 00186 static const bool is_exact = true; 00187 static const int radix = 2; 00188 static char epsilon() throw() 00189 { return 0; } 00190 static char round_error() throw() 00191 { return 0; } 00192 00193 static const int min_exponent = 0; 00194 static const int min_exponent10 = 0; 00195 static const int max_exponent = 0; 00196 static const int max_exponent10 = 0; 00197 00198 static const bool has_infinity = false; 00199 static const bool has_quiet_NaN = false; 00200 static const bool has_signaling_NaN = false; 00201 static const float_denorm_style has_denorm = denorm_absent; 00202 static const bool has_denorm_loss = false; 00203 00204 static char infinity() throw() 00205 { return static_cast<char>(0); } 00206 static char quiet_NaN() throw() 00207 { return static_cast<char>(0); } 00208 static char signaling_NaN() throw() 00209 { return static_cast<char>(0); } 00210 static char denorm_min() throw() 00211 { return static_cast<char>(0); } 00212 00213 static const bool is_iec559 = false; 00214 static const bool is_bounded = true; 00215 static const bool is_modulo = false; 00216 00217 static const bool traps = false; 00218 static const bool tinyness_before = false; 00219 static const float_round_style round_style = round_toward_zero; 00220 }; 00221 00222 template<> struct numeric_limits<signed char> { 00223 static const bool is_specialized = true; 00224 00225 static signed char min() throw() 00226 { return SCHAR_MIN; } 00227 static signed char max() throw() 00228 { return SCHAR_MAX; } 00229 00230 static const int digits = 7; 00231 static const int digits10 = 2; 00232 static const bool is_signed = true; 00233 static const bool is_integer = true; 00234 static const bool is_exact = true; 00235 static const int radix = 2; 00236 static signed char epsilon() throw() 00237 { return 0; } 00238 static signed char round_error() throw() 00239 { return 0; } 00240 00241 static const int min_exponent = 0; 00242 static const int min_exponent10 = 0; 00243 static const int max_exponent = 0; 00244 static const int max_exponent10 = 0; 00245 00246 static const bool has_infinity = false; 00247 static const bool has_quiet_NaN = false; 00248 static const bool has_signaling_NaN = false; 00249 static const float_denorm_style has_denorm = denorm_absent; 00250 static const bool has_denorm_loss = false; 00251 00252 static signed char infinity() throw() 00253 { return static_cast<signed char>(0); } 00254 static signed char quiet_NaN() throw() 00255 { return static_cast<signed char>(0); } 00256 static signed char signaling_NaN() throw() 00257 { return static_cast<signed char>(0); } 00258 static signed char denorm_min() throw() 00259 { return static_cast<signed char>(0); } 00260 00261 static const bool is_iec559 = false; 00262 static const bool is_bounded = true; 00263 static const bool is_modulo = false; 00264 00265 static const bool traps = false; 00266 static const bool tinyness_before = false; 00267 static const float_round_style round_style = round_toward_zero; 00268 }; 00269 00270 template<> struct numeric_limits<unsigned char> { 00271 static const bool is_specialized = true; 00272 00273 static unsigned char min() throw() 00274 { return 0; } 00275 static unsigned char max() throw() 00276 { return UCHAR_MAX; } 00277 00278 static const int digits = 8; 00279 static const int digits10 = 2; 00280 static const bool is_signed = false; 00281 static const bool is_integer = true; 00282 static const bool is_exact = true; 00283 static const int radix = 2; 00284 static unsigned char epsilon() throw() 00285 { return 0; } 00286 static unsigned char round_error() throw() 00287 { return 0; } 00288 00289 static const int min_exponent = 0; 00290 static const int min_exponent10 = 0; 00291 static const int max_exponent = 0; 00292 static const int max_exponent10 = 0; 00293 00294 static const bool has_infinity = false; 00295 static const bool has_quiet_NaN = false; 00296 static const bool has_signaling_NaN = false; 00297 static const float_denorm_style has_denorm = denorm_absent; 00298 static const bool has_denorm_loss = false; 00299 00300 static unsigned char infinity() throw() 00301 { return static_cast<unsigned char>(0); } 00302 static unsigned char quiet_NaN() throw() 00303 { return static_cast<unsigned char>(0); } 00304 static unsigned char signaling_NaN() throw() 00305 { return static_cast<unsigned char>(0); } 00306 static unsigned char denorm_min() throw() 00307 { return static_cast<unsigned char>(0); } 00308 00309 static const bool is_iec559 = false; 00310 static const bool is_bounded = true; 00311 static const bool is_modulo = true; 00312 00313 static const bool traps = true; 00314 static const bool tinyness_before = false; 00315 static const float_round_style round_style = round_toward_zero; 00316 }; 00317 00318 #if defined( _GLIBCPP_USE_WCHAR_T) 00319 template<> struct numeric_limits<wchar_t> { 00320 static const bool is_specialized = true; 00321 00322 static wchar_t min() throw() 00323 { return WCHAR_MIN; } 00324 static wchar_t max() throw() 00325 { return WCHAR_MAX; } 00326 00327 static const int digits = 31; 00328 static const int digits10 = 9; 00329 static const bool is_signed = true; 00330 static const bool is_integer = true; 00331 static const bool is_exact = true; 00332 static const int radix = 2; 00333 static wchar_t epsilon() throw() 00334 { return 0; } 00335 static wchar_t round_error() throw() 00336 { return 0; } 00337 00338 static const int min_exponent = 0; 00339 static const int min_exponent10 = 0; 00340 static const int max_exponent = 0; 00341 static const int max_exponent10 = 0; 00342 00343 static const bool has_infinity = false; 00344 static const bool has_quiet_NaN = false; 00345 static const bool has_signaling_NaN = false; 00346 static const float_denorm_style has_denorm = denorm_absent; 00347 static const bool has_denorm_loss = false; 00348 00349 static wchar_t infinity() throw() 00350 { return static_cast<wchar_t>(0); } 00351 static wchar_t quiet_NaN() throw() 00352 { return static_cast<wchar_t>(0); } 00353 static wchar_t signaling_NaN() throw() 00354 { return static_cast<wchar_t>(0); } 00355 static wchar_t denorm_min() throw() 00356 { return static_cast<wchar_t>(0); } 00357 00358 static const bool is_iec559 = false; 00359 static const bool is_bounded = true; 00360 static const bool is_modulo = false; 00361 00362 static const bool traps = false; 00363 static const bool tinyness_before = false; 00364 static const float_round_style round_style = round_toward_zero; 00365 }; 00366 #endif 00367 00368 template<> struct numeric_limits<short> { 00369 static const bool is_specialized = true; 00370 00371 static short min() throw() 00372 { return SHRT_MIN; } 00373 static short max() throw() 00374 { return SHRT_MAX; } 00375 00376 static const int digits = 15; 00377 static const int digits10 = 4; 00378 static const bool is_signed = true; 00379 static const bool is_integer = true; 00380 static const bool is_exact = true; 00381 static const int radix = 2; 00382 static short epsilon() throw() 00383 { return 0; } 00384 static short round_error() throw() 00385 { return 0; } 00386 00387 static const int min_exponent = 0; 00388 static const int min_exponent10 = 0; 00389 static const int max_exponent = 0; 00390 static const int max_exponent10 = 0; 00391 00392 static const bool has_infinity = false; 00393 static const bool has_quiet_NaN = false; 00394 static const bool has_signaling_NaN = false; 00395 static const float_denorm_style has_denorm = denorm_absent; 00396 static const bool has_denorm_loss = false; 00397 00398 static short infinity() throw() 00399 { return static_cast<short>(0); } 00400 static short quiet_NaN() throw() 00401 { return static_cast<short>(0); } 00402 static short signaling_NaN() throw() 00403 { return static_cast<short>(0); } 00404 static short denorm_min() throw() 00405 { return static_cast<short>(0); } 00406 00407 static const bool is_iec559 = false; 00408 static const bool is_bounded = true; 00409 static const bool is_modulo = false; 00410 00411 static const bool traps = false; 00412 static const bool tinyness_before = false; 00413 static const float_round_style round_style = round_toward_zero; 00414 }; 00415 00416 template<> struct numeric_limits<unsigned short> { 00417 static const bool is_specialized = true; 00418 00419 static unsigned short min() throw() 00420 { return 0; } 00421 static unsigned short max() throw() 00422 { return USHRT_MAX; } 00423 00424 static const int digits = 16; 00425 static const int digits10 = 4; 00426 static const bool is_signed = false; 00427 static const bool is_integer = true; 00428 static const bool is_exact = true; 00429 static const int radix = 2; 00430 static unsigned short epsilon() throw() 00431 { return 0; } 00432 static unsigned short round_error() throw() 00433 { return 0; } 00434 00435 static const int min_exponent = 0; 00436 static const int min_exponent10 = 0; 00437 static const int max_exponent = 0; 00438 static const int max_exponent10 = 0; 00439 00440 static const bool has_infinity = false; 00441 static const bool has_quiet_NaN = false; 00442 static const bool has_signaling_NaN = false; 00443 static const float_denorm_style has_denorm = denorm_absent; 00444 static const bool has_denorm_loss = false; 00445 00446 static unsigned short infinity() throw() 00447 { return static_cast<unsigned short>(0); } 00448 static unsigned short quiet_NaN() throw() 00449 { return static_cast<unsigned short>(0); } 00450 static unsigned short signaling_NaN() throw() 00451 { return static_cast<unsigned short>(0); } 00452 static unsigned short denorm_min() throw() 00453 { return static_cast<unsigned short>(0); } 00454 00455 static const bool is_iec559 = false; 00456 static const bool is_bounded = true; 00457 static const bool is_modulo = true; 00458 00459 static const bool traps = true; 00460 static const bool tinyness_before = false; 00461 static const float_round_style round_style = round_toward_zero; 00462 }; 00463 00464 template<> struct numeric_limits<int> { 00465 static const bool is_specialized = true; 00466 00467 static int min() throw() 00468 { return INT_MIN; } 00469 static int max() throw() 00470 { return INT_MAX; } 00471 00472 #if INT_MAX > 32767 00473 static const int digits = 31; 00474 static const int digits10 = 9; 00475 #else 00476 static const int digits = 15; 00477 static const int digits10 = 4; 00478 #endif 00479 static const bool is_signed = true; 00480 static const bool is_integer = true; 00481 static const bool is_exact = true; 00482 static const int radix = 2; 00483 static int epsilon() throw() 00484 { return 0; } 00485 static int round_error() throw() 00486 { return 0; } 00487 00488 static const int min_exponent = 0; 00489 static const int min_exponent10 = 0; 00490 static const int max_exponent = 0; 00491 static const int max_exponent10 = 0; 00492 00493 static const bool has_infinity = false; 00494 static const bool has_quiet_NaN = false; 00495 static const bool has_signaling_NaN = false; 00496 static const float_denorm_style has_denorm = denorm_absent; 00497 static const bool has_denorm_loss = false; 00498 00499 static int infinity() throw() 00500 { return static_cast<int>(0); } 00501 static int quiet_NaN() throw() 00502 { return static_cast<int>(0); } 00503 static int signaling_NaN() throw() 00504 { return static_cast<int>(0); } 00505 static int denorm_min() throw() 00506 { return static_cast<int>(0); } 00507 00508 static const bool is_iec559 = true; 00509 static const bool is_bounded = true; 00510 static const bool is_modulo = false; 00511 00512 static const bool traps = false; 00513 static const bool tinyness_before = false; 00514 static const float_round_style round_style = round_toward_zero; 00515 }; 00516 00517 template<> struct numeric_limits<unsigned int> { 00518 static const bool is_specialized = true; 00519 00520 static unsigned int min() throw() 00521 { return 0; } 00522 static unsigned int max() throw() 00523 { return UINT_MAX; } 00524 00525 #if INT_MAX > 32767 00526 static const int digits = 32; 00527 static const int digits10 = 9; 00528 #else 00529 static const int digits = 16; 00530 static const int digits10 = 4; 00531 #endif 00532 static const bool is_signed = false; 00533 static const bool is_integer = true; 00534 static const bool is_exact = true; 00535 static const int radix = 2; 00536 static unsigned int epsilon() throw() 00537 { return 0; } 00538 static unsigned int round_error() throw() 00539 { return 0; } 00540 00541 static const int min_exponent = 0; 00542 static const int min_exponent10 = 0; 00543 static const int max_exponent = 0; 00544 static const int max_exponent10 = 0; 00545 00546 static const bool has_infinity = false; 00547 static const bool has_quiet_NaN = false; 00548 static const bool has_signaling_NaN = false; 00549 static const float_denorm_style has_denorm = denorm_absent; 00550 static const bool has_denorm_loss = false; 00551 00552 static unsigned int infinity() throw() 00553 { return static_cast<unsigned int>(0); } 00554 static unsigned int quiet_NaN() throw() 00555 { return static_cast<unsigned int>(0); } 00556 static unsigned int signaling_NaN() throw() 00557 { return static_cast<unsigned int>(0); } 00558 static unsigned int denorm_min() throw() 00559 { return static_cast<unsigned int>(0); } 00560 00561 static const bool is_iec559 = true; 00562 static const bool is_bounded = true; 00563 static const bool is_modulo = true; 00564 00565 static const bool traps = true; 00566 static const bool tinyness_before = false; 00567 static const float_round_style round_style = round_toward_zero; 00568 }; 00569 00570 template<> struct numeric_limits<long> { 00571 static const bool is_specialized = true; 00572 00573 static long min() throw() 00574 { return LONG_MIN; } 00575 static long max() throw() 00576 { return LONG_MAX; } 00577 00578 #if LONG_MAX > 2147483647 00579 static const int digits = 63; 00580 static const int digits10 = 18; 00581 #elif LONG_MAX > 32767 00582 static const int digits = 31; 00583 static const int digits10 = 9; 00584 #else 00585 static const int digits = 15; 00586 static const int digits10 = 4; 00587 #endif 00588 static const bool is_signed = true; 00589 static const bool is_integer = true; 00590 static const bool is_exact = true; 00591 static const int radix = 2; 00592 static long epsilon() throw() 00593 { return 0; } 00594 static long round_error() throw() 00595 { return 0; } 00596 00597 static const int min_exponent = 0; 00598 static const int min_exponent10 = 0; 00599 static const int max_exponent = 0; 00600 static const int max_exponent10 = 0; 00601 00602 static const bool has_infinity = false; 00603 static const bool has_quiet_NaN = false; 00604 static const bool has_signaling_NaN = false; 00605 static const float_denorm_style has_denorm = denorm_absent; 00606 static const bool has_denorm_loss = false; 00607 00608 static long infinity() throw() 00609 { return static_cast<long>(0); } 00610 static long quiet_NaN() throw() 00611 { return static_cast<long>(0); } 00612 static long signaling_NaN() throw() 00613 { return static_cast<long>(0); } 00614 static long denorm_min() throw() 00615 { return static_cast<long>(0); } 00616 00617 static const bool is_iec559 = true; 00618 static const bool is_bounded = true; 00619 static const bool is_modulo = false; 00620 00621 static const bool traps = false; 00622 static const bool tinyness_before = false; 00623 static const float_round_style round_style = round_toward_zero; 00624 }; 00625 00626 template<> struct numeric_limits<unsigned long> { 00627 static const bool is_specialized = true; 00628 00629 static unsigned long min() throw() 00630 { return 0; } 00631 static unsigned long max() throw() 00632 { return ULONG_MAX; } 00633 00634 #if LONG_MAX > 2147483647 00635 static const int digits = 64; 00636 static const int digits10 = 19; 00637 #elif LONG_MAX > 32767 00638 static const int digits = 32; 00639 static const int digits10 = 9; 00640 #else 00641 static const int digits = 16; 00642 static const int digits10 = 4; 00643 #endif 00644 static const bool is_signed = false; 00645 static const bool is_integer = true; 00646 static const bool is_exact = true; 00647 static const int radix = 2; 00648 static unsigned long epsilon() throw() 00649 { return 0; } 00650 static unsigned long round_error() throw() 00651 { return 0; } 00652 00653 static const int min_exponent = 0; 00654 static const int min_exponent10 = 0; 00655 static const int max_exponent = 0; 00656 static const int max_exponent10 = 0; 00657 00658 static const bool has_infinity = false; 00659 static const bool has_quiet_NaN = false; 00660 static const bool has_signaling_NaN = false; 00661 static const float_denorm_style has_denorm = denorm_absent; 00662 static const bool has_denorm_loss = false; 00663 00664 static unsigned long infinity() throw() 00665 { return static_cast<unsigned long>(0); } 00666 static unsigned long quiet_NaN() throw() 00667 { return static_cast<unsigned long>(0); } 00668 static unsigned long signaling_NaN() throw() 00669 { return static_cast<unsigned long>(0); } 00670 static unsigned long denorm_min() throw() 00671 { return static_cast<unsigned long>(0); } 00672 00673 static const bool is_iec559 = true; 00674 static const bool is_bounded = true; 00675 static const bool is_modulo = true; 00676 00677 static const bool traps = true; 00678 static const bool tinyness_before = false; 00679 static const float_round_style round_style = round_toward_zero; 00680 }; 00681 00682 template<> struct numeric_limits<float> { 00683 static const bool is_specialized = true; 00684 00685 static float min() throw() 00686 { return FLT_MIN; } 00687 static float max() throw() 00688 { return FLT_MAX; } 00689 00690 static const int digits = FLT_MANT_DIG; 00691 static const int digits10 = FLT_DIG; 00692 static const bool is_signed = true; 00693 static const bool is_integer = false; 00694 static const bool is_exact = false; 00695 static const int radix = FLT_RADIX; 00696 static float epsilon() throw() 00697 { return FLT_EPSILON; } 00698 static float round_error() throw() 00699 { return FLT_ROUNDS; } 00700 00701 static const int min_exponent = FLT_MIN_EXP; 00702 static const int min_exponent10 = FLT_MIN_10_EXP; 00703 static const int max_exponent = FLT_MAX_EXP; 00704 static const int max_exponent10 = FLT_MAX_10_EXP; 00705 00706 static const bool has_infinity = false; 00707 static const bool has_quiet_NaN = false; 00708 static const bool has_signaling_NaN = false; 00709 static const float_denorm_style has_denorm = denorm_absent; 00710 static const bool has_denorm_loss = false; 00711 00712 static float infinity() throw() 00713 { return static_cast<float>(0); } 00714 static float quiet_NaN() throw() 00715 { return static_cast<float>(0); } 00716 static float signaling_NaN() throw() 00717 { return static_cast<float>(0); } 00718 static float denorm_min() throw() 00719 { return static_cast<float>(0); } 00720 00721 static const bool is_iec559 = false; 00722 static const bool is_bounded = true; 00723 static const bool is_modulo = false; 00724 00725 static const bool traps = false; 00726 static const bool tinyness_before = false; 00727 static const float_round_style round_style = round_toward_zero; 00728 }; 00729 00730 template<> struct numeric_limits<double> { 00731 static const bool is_specialized = true; 00732 00733 static double min() throw() 00734 { return DBL_MIN; } 00735 static double max() throw() 00736 { return DBL_MAX; } 00737 00738 static const int digits = DBL_MANT_DIG; 00739 static const int digits10 = DBL_DIG; 00740 static const bool is_signed = true; 00741 static const bool is_integer = false; 00742 static const bool is_exact = false; 00743 static const int radix = 2; 00744 static double epsilon() throw() 00745 { return DBL_EPSILON; } 00746 static double round_error() throw() 00747 { return 1.0; } 00748 00749 static const int min_exponent = DBL_MIN_EXP; 00750 static const int min_exponent10 = DBL_MIN_10_EXP; 00751 static const int max_exponent = DBL_MAX_EXP; 00752 static const int max_exponent10 = DBL_MAX_10_EXP; 00753 00754 static const bool has_infinity = false; 00755 static const bool has_quiet_NaN = false; 00756 static const bool has_signaling_NaN = false; 00757 static const float_denorm_style has_denorm = denorm_absent; 00758 static const bool has_denorm_loss = false; 00759 00760 static double infinity() throw() 00761 { return static_cast<double>(0); } 00762 static double quiet_NaN() throw() 00763 { return static_cast<double>(0); } 00764 static double signaling_NaN() throw() 00765 { return static_cast<double>(0); } 00766 static double denorm_min() throw() 00767 { return static_cast<double>(0); } 00768 00769 static const bool is_iec559 = false; 00770 static const bool is_bounded = true; 00771 static const bool is_modulo = false; 00772 00773 static const bool traps = false; 00774 static const bool tinyness_before = false; 00775 static const float_round_style round_style = round_toward_zero; 00776 }; 00777 00778 template<> struct numeric_limits<long double> { 00779 static const bool is_specialized = true; 00780 00781 static double min() throw() 00782 { return LDBL_MIN; } 00783 static double max() throw() 00784 { return LDBL_MAX; } 00785 00786 static const int digits = LDBL_MANT_DIG; 00787 static const int digits10 = LDBL_DIG; 00788 static const bool is_signed = true; 00789 static const bool is_integer = false; 00790 static const bool is_exact = false; 00791 static const int radix = 2; 00792 static double epsilon() throw() 00793 { return LDBL_EPSILON; } 00794 static double round_error() throw() 00795 { return 1.0L; } 00796 00797 static const int min_exponent = LDBL_MIN_EXP; 00798 static const int min_exponent10 = LDBL_MIN_10_EXP; 00799 static const int max_exponent = LDBL_MAX_EXP; 00800 static const int max_exponent10 = LDBL_MAX_10_EXP; 00801 00802 static const bool has_infinity = false; 00803 static const bool has_quiet_NaN = false; 00804 static const bool has_signaling_NaN = false; 00805 static const float_denorm_style has_denorm = denorm_absent; 00806 static const bool has_denorm_loss = false; 00807 00808 static double infinity() throw() 00809 { return static_cast<double>(0); } 00810 static double quiet_NaN() throw() 00811 { return static_cast<double>(0); } 00812 static double signaling_NaN() throw() 00813 { return static_cast<double>(0); } 00814 static double denorm_min() throw() 00815 { return static_cast<double>(0); } 00816 00817 static const bool is_iec559 = false; 00818 static const bool is_bounded = true; 00819 static const bool is_modulo = false; 00820 00821 static const bool traps = false; 00822 static const bool tinyness_before = false; 00823 static const float_round_style round_style = round_toward_zero; 00824 }; 00825 00826 } // namespace std 00827 00828 #endif // _CPP_NUMERIC_LIMITS Generated on Mon Apr 8 03:11:28 2002 for libstdc++-v3 Source by ![]() |