1 /* 2 * Copyright (c) 1997 3 * Silicon Graphics Computer Systems, Inc. 4 * 5 * Copyright (c) 1999 6 * Boris Fomitchev 7 * 8 * This material is provided "as is", with absolutely no warranty expressed 9 * or implied. Any use is at your own risk. 10 * 11 * Permission to use or copy this software for any purpose is hereby granted 12 * without fee, provided the above notices are retained on all copies. 13 * Permission to modify the code and to distribute modified code is granted, 14 * provided the above notices are retained, and a notice that the code was 15 * modified is included with the above copyright notice. 16 * 17 */ 18 19 /* NOTE: This may be not portable code. Parts of numeric_limits<> are 20 * inherently machine-dependent. At present this file is suitable 21 * for the MIPS, SPARC, Alpha and ia32 architectures. 22 */ 23 24 #ifndef _STLP_INTERNAL_LIMITS 25 #define _STLP_INTERNAL_LIMITS 26 27 #ifndef _STLP_CLIMITS 28 # include <climits> 29 #endif 30 31 #ifndef _STLP_CFLOAT 32 # include <cfloat> 33 #endif 34 35 #if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR) 36 # include <stl/_cwchar.h> 37 #endif 38 39 _STLP_BEGIN_NAMESPACE 40 41 enum float_round_style { 42 round_indeterminate = -1, 43 round_toward_zero = 0, 44 round_to_nearest = 1, 45 round_toward_infinity = 2, 46 round_toward_neg_infinity = 3 47 }; 48 49 enum float_denorm_style { 50 denorm_indeterminate = -1, 51 denorm_absent = 0, 52 denorm_present = 1 53 }; 54 55 _STLP_MOVE_TO_PRIV_NAMESPACE 56 57 // Base class for all specializations of numeric_limits. 58 template <class __number> 59 class _Numeric_limits_base { 60 public: 61 __number(_STLP_CALL min)62 static __number (_STLP_CALL min)() _STLP_NOTHROW { return __number(); } __number(_STLP_CALL max)63 static __number (_STLP_CALL max)() _STLP_NOTHROW { return __number(); } 64 65 _STLP_STATIC_CONSTANT(int, digits = 0); 66 _STLP_STATIC_CONSTANT(int, digits10 = 0); 67 _STLP_STATIC_CONSTANT(int, radix = 0); 68 _STLP_STATIC_CONSTANT(int, min_exponent = 0); 69 _STLP_STATIC_CONSTANT(int, min_exponent10 = 0); 70 _STLP_STATIC_CONSTANT(int, max_exponent = 0); 71 _STLP_STATIC_CONSTANT(int, max_exponent10 = 0); 72 73 _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = denorm_absent); 74 _STLP_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); 75 76 _STLP_STATIC_CONSTANT(bool, is_specialized = false); 77 _STLP_STATIC_CONSTANT(bool, is_signed = false); 78 _STLP_STATIC_CONSTANT(bool, is_integer = false); 79 _STLP_STATIC_CONSTANT(bool, is_exact = false); 80 _STLP_STATIC_CONSTANT(bool, has_infinity = false); 81 _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false); 82 _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false); 83 _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false); 84 _STLP_STATIC_CONSTANT(bool, is_iec559 = false); 85 _STLP_STATIC_CONSTANT(bool, is_bounded = false); 86 _STLP_STATIC_CONSTANT(bool, is_modulo = false); 87 _STLP_STATIC_CONSTANT(bool, traps = false); 88 _STLP_STATIC_CONSTANT(bool, tinyness_before = false); 89 epsilon()90 static __number _STLP_CALL epsilon() _STLP_NOTHROW { return __number(); } round_error()91 static __number _STLP_CALL round_error() _STLP_NOTHROW { return __number(); } 92 infinity()93 static __number _STLP_CALL infinity() _STLP_NOTHROW { return __number(); } quiet_NaN()94 static __number _STLP_CALL quiet_NaN() _STLP_NOTHROW { return __number(); } signaling_NaN()95 static __number _STLP_CALL signaling_NaN() _STLP_NOTHROW { return __number(); } denorm_min()96 static __number _STLP_CALL denorm_min() _STLP_NOTHROW { return __number(); } 97 }; 98 99 // Base class for integers. 100 101 #ifdef _STLP_LIMITED_DEFAULT_TEMPLATES 102 # ifdef _STLP_LONG_LONG 103 # define _STLP_LIMITS_MIN_TYPE _STLP_LONG_LONG 104 # define _STLP_LIMITS_MAX_TYPE unsigned _STLP_LONG_LONG 105 # else 106 # define _STLP_LIMITS_MIN_TYPE long 107 # define _STLP_LIMITS_MAX_TYPE unsigned long 108 # endif 109 #else 110 # define _STLP_LIMITS_MIN_TYPE _Int 111 # define _STLP_LIMITS_MAX_TYPE _Int 112 #endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */ 113 114 template <class _Int, 115 _STLP_LIMITS_MIN_TYPE __imin, 116 _STLP_LIMITS_MAX_TYPE __imax, 117 int __idigits, bool __ismod> 118 class _Integer_limits : public _Numeric_limits_base<_Int> { 119 public: 120 _Int(_STLP_CALL min)121 static _Int (_STLP_CALL min) () _STLP_NOTHROW { return (_Int)__imin; } _Int(_STLP_CALL max)122 static _Int (_STLP_CALL max) () _STLP_NOTHROW { return (_Int)__imax; } 123 124 _STLP_STATIC_CONSTANT(int, digits = (__idigits < 0) ? ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1)) : (__idigits)); 125 _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000); 126 _STLP_STATIC_CONSTANT(int, radix = 2); 127 _STLP_STATIC_CONSTANT(bool, is_specialized = true); 128 _STLP_STATIC_CONSTANT(bool, is_signed = (__imin != 0)); 129 _STLP_STATIC_CONSTANT(bool, is_integer = true); 130 _STLP_STATIC_CONSTANT(bool, is_exact = true); 131 _STLP_STATIC_CONSTANT(bool, is_bounded = true); 132 _STLP_STATIC_CONSTANT(bool, is_modulo = __ismod); 133 }; 134 135 // Base class for floating-point numbers. 136 template <class __number, 137 int __Digits, int __Digits10, 138 int __MinExp, int __MaxExp, 139 int __MinExp10, int __MaxExp10, 140 bool __IsIEC559, 141 float_denorm_style __DenormStyle, 142 float_round_style __RoundStyle> 143 class _Floating_limits : public _Numeric_limits_base<__number> { 144 public: 145 146 _STLP_STATIC_CONSTANT(int, digits = __Digits); 147 _STLP_STATIC_CONSTANT(int, digits10 = __Digits10); 148 _STLP_STATIC_CONSTANT(int, radix = FLT_RADIX); 149 _STLP_STATIC_CONSTANT(int, min_exponent = __MinExp); 150 _STLP_STATIC_CONSTANT(int, max_exponent = __MaxExp); 151 _STLP_STATIC_CONSTANT(int, min_exponent10 = __MinExp10); 152 _STLP_STATIC_CONSTANT(int, max_exponent10 = __MaxExp10); 153 154 _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = __DenormStyle); 155 _STLP_STATIC_CONSTANT(float_round_style, round_style = __RoundStyle); 156 157 _STLP_STATIC_CONSTANT(bool, is_specialized = true); 158 _STLP_STATIC_CONSTANT(bool, is_signed = true); 159 160 _STLP_STATIC_CONSTANT(bool, has_infinity = true); 161 #if (!defined (_STLP_MSVC) || (_STLP_MSVC > 1300)) && \ 162 (!defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)) && \ 163 (!defined (_CRAY) || defined (_CRAYIEEE)) 164 _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = true); 165 _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = true); 166 #else 167 _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false); 168 _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false); 169 #endif 170 171 _STLP_STATIC_CONSTANT(bool, is_iec559 = __IsIEC559 && has_infinity && has_quiet_NaN && has_signaling_NaN && (has_denorm == denorm_present)); 172 _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false); 173 _STLP_STATIC_CONSTANT(bool, is_bounded = true); 174 _STLP_STATIC_CONSTANT(bool, traps = true); 175 _STLP_STATIC_CONSTANT(bool, tinyness_before = false); 176 }; 177 178 _STLP_MOVE_TO_STD_NAMESPACE 179 180 // Class numeric_limits 181 182 // The unspecialized class. 183 184 template<class _Tp> 185 class numeric_limits : public _STLP_PRIV _Numeric_limits_base<_Tp> {}; 186 187 // Specializations for all built-in integral types. 188 189 #if !defined (_STLP_NO_BOOL) 190 _STLP_TEMPLATE_NULL 191 class numeric_limits<bool> 192 : public _STLP_PRIV _Integer_limits<bool, false, true, 1, false> 193 {}; 194 #endif /* _STLP_NO_BOOL */ 195 196 _STLP_TEMPLATE_NULL 197 class numeric_limits<char> 198 : public _STLP_PRIV _Integer_limits<char, CHAR_MIN, CHAR_MAX, -1, true> 199 {}; 200 201 #if !defined (_STLP_NO_SIGNED_BUILTINS) 202 _STLP_TEMPLATE_NULL 203 class numeric_limits<signed char> 204 : public _STLP_PRIV _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX, -1, true> 205 {}; 206 #endif 207 208 _STLP_TEMPLATE_NULL 209 class numeric_limits<unsigned char> 210 : public _STLP_PRIV _Integer_limits<unsigned char, 0, UCHAR_MAX, -1, true> 211 {}; 212 213 #if !(defined (_STLP_NO_WCHAR_T) || defined (_STLP_WCHAR_T_IS_USHORT)) 214 215 _STLP_TEMPLATE_NULL 216 class numeric_limits<wchar_t> 217 : public _STLP_PRIV _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX, -1, true> 218 {}; 219 220 #endif 221 222 _STLP_TEMPLATE_NULL 223 class numeric_limits<short> 224 : public _STLP_PRIV _Integer_limits<short, SHRT_MIN, SHRT_MAX, -1, true> 225 {}; 226 227 _STLP_TEMPLATE_NULL 228 class numeric_limits<unsigned short> 229 : public _STLP_PRIV _Integer_limits<unsigned short, 0, USHRT_MAX, -1, true> 230 {}; 231 232 #if defined (__xlC__) && (__xlC__ == 0x500) 233 # undef INT_MIN 234 # define INT_MIN -2147483648 235 #endif 236 237 _STLP_TEMPLATE_NULL 238 class numeric_limits<int> 239 : public _STLP_PRIV _Integer_limits<int, INT_MIN, INT_MAX, -1, true> 240 {}; 241 242 _STLP_TEMPLATE_NULL 243 class numeric_limits<unsigned int> 244 : public _STLP_PRIV _Integer_limits<unsigned int, 0, UINT_MAX, -1, true> 245 {}; 246 247 _STLP_TEMPLATE_NULL 248 class numeric_limits<long> 249 : public _STLP_PRIV _Integer_limits<long, LONG_MIN, LONG_MAX, -1, true> 250 {}; 251 252 _STLP_TEMPLATE_NULL 253 class numeric_limits<unsigned long> 254 : public _STLP_PRIV _Integer_limits<unsigned long, 0, ULONG_MAX, -1, true> 255 {}; 256 257 #if defined (_STLP_LONG_LONG) 258 259 # if defined (_STLP_MSVC) || defined (__BORLANDC__) 260 # define LONGLONG_MAX 0x7fffffffffffffffi64 261 # define LONGLONG_MIN (-LONGLONG_MAX-1i64) 262 # define ULONGLONG_MAX 0xffffffffffffffffUi64 263 # else 264 # ifndef LONGLONG_MAX 265 # define LONGLONG_MAX 0x7fffffffffffffffLL 266 # endif 267 # ifndef LONGLONG_MIN 268 # define LONGLONG_MIN (-LONGLONG_MAX-1LL) 269 # endif 270 # ifndef ULONGLONG_MAX 271 # define ULONGLONG_MAX 0xffffffffffffffffULL 272 # endif 273 # endif 274 275 # if !defined (__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ <= 96) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 3) 276 277 _STLP_TEMPLATE_NULL 278 class numeric_limits<_STLP_LONG_LONG> 279 : public _STLP_PRIV _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true> 280 {}; 281 282 _STLP_TEMPLATE_NULL 283 class numeric_limits<unsigned _STLP_LONG_LONG> 284 : public _STLP_PRIV _Integer_limits<unsigned _STLP_LONG_LONG, 0, ULONGLONG_MAX, -1, true> 285 {}; 286 # else /* gcc 2.97 (after 2000-11-01), 2.98, 3.0 */ 287 /* 288 newest gcc has new mangling scheme, that has problem 289 with generating name [instantiated] of template specialization like 290 _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true> 291 ~~~~~~~~~~~~ ~~~~~~~~~~~~ 292 Below is code that solve this problem. 293 - ptr 294 */ 295 _STLP_TEMPLATE_NULL 296 class numeric_limits<_STLP_LONG_LONG> 297 : public _STLP_PRIV _Numeric_limits_base<_STLP_LONG_LONG> { 298 public: 299 _STLP_LONG_LONG(_STLP_CALL min)300 static _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return LONGLONG_MIN; } _STLP_LONG_LONG(_STLP_CALL max)301 static _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return LONGLONG_MAX; } 302 303 _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(_STLP_LONG_LONG) * (CHAR_BIT))) - 1)); 304 _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000); 305 _STLP_STATIC_CONSTANT(int, radix = 2); 306 _STLP_STATIC_CONSTANT(bool, is_specialized = true); 307 _STLP_STATIC_CONSTANT(bool, is_signed = true); 308 _STLP_STATIC_CONSTANT(bool, is_integer = true); 309 _STLP_STATIC_CONSTANT(bool, is_exact = true); 310 _STLP_STATIC_CONSTANT(bool, is_bounded = true); 311 _STLP_STATIC_CONSTANT(bool, is_modulo = true); 312 }; 313 314 _STLP_TEMPLATE_NULL 315 class numeric_limits<unsigned _STLP_LONG_LONG> 316 : public _STLP_PRIV _Numeric_limits_base<unsigned _STLP_LONG_LONG> { 317 public: 318 _STLP_LONG_LONG(_STLP_CALL min)319 static unsigned _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return 0ULL; } _STLP_LONG_LONG(_STLP_CALL max)320 static unsigned _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return ULONGLONG_MAX; } 321 322 _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(unsigned _STLP_LONG_LONG) * (CHAR_BIT))))); 323 _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000); 324 _STLP_STATIC_CONSTANT(int, radix = 2); 325 _STLP_STATIC_CONSTANT(bool, is_specialized = true); 326 _STLP_STATIC_CONSTANT(bool, is_signed = false); 327 _STLP_STATIC_CONSTANT(bool, is_integer = true); 328 _STLP_STATIC_CONSTANT(bool, is_exact = true); 329 _STLP_STATIC_CONSTANT(bool, is_bounded = true); 330 _STLP_STATIC_CONSTANT(bool, is_modulo = true); 331 }; 332 333 # endif /* __GNUC__ > 2000-11-01 */ 334 335 #endif /* _STLP_LONG_LONG */ 336 337 _STLP_MOVE_TO_PRIV_NAMESPACE 338 339 // Specializations for all built-in floating-point types. 340 template <class __dummy> 341 class _LimG { 342 public: 343 static float _STLP_CALL get_F_inf(); 344 static float _STLP_CALL get_F_qNaN(); 345 static float _STLP_CALL get_F_sNaN(); 346 static float _STLP_CALL get_F_denormMin(); 347 static double _STLP_CALL get_D_inf(); 348 static double _STLP_CALL get_D_qNaN(); 349 static double _STLP_CALL get_D_sNaN(); 350 static double _STLP_CALL get_D_denormMin(); 351 352 #if !defined (_STLP_NO_LONG_DOUBLE) 353 static long double _STLP_CALL get_LD_inf(); 354 static long double _STLP_CALL get_LD_qNaN(); 355 static long double _STLP_CALL get_LD_sNaN(); 356 static long double _STLP_CALL get_LD_denormMin(); 357 #endif 358 }; 359 360 #if defined (_STLP_USE_TEMPLATE_EXPORT) 361 _STLP_EXPORT_TEMPLATE_CLASS _LimG<bool>; 362 #endif 363 364 #if defined (__GNUC__) 365 # if defined (__FLT_DENORM_MIN__) 366 # define _STLP_FLT_DENORM_MIN __FLT_DENORM_MIN__ 367 # else 368 # define _STLP_FLT_DENORM_STYLE denorm_absent 369 # endif 370 # if defined (__DBL_DENORM_MIN__) 371 # define _STLP_DBL_DENORM_MIN __DBL_DENORM_MIN__ 372 # else 373 # define _STLP_DBL_DENORM_STYLE denorm_absent 374 # endif 375 # if defined (__LDBL_DENORM_MIN__) 376 # define _STLP_LDBL_DENORM_MIN __LDBL_DENORM_MIN__ 377 # else 378 # define _STLP_LDBL_DENORM_STYLE denorm_absent 379 # endif 380 #endif 381 382 /* If compiler do not expose thanks to some macro its status regarding 383 * denormalized floating point numbers, we consider that denormalization 384 * is present. Unit tests will tell us if compiler do not support them. */ 385 #if !defined (_STLP_FLT_DENORM_STYLE) 386 # define _STLP_FLT_DENORM_STYLE denorm_present 387 #endif 388 389 #if !defined (_STLP_DBL_DENORM_STYLE) 390 # define _STLP_DBL_DENORM_STYLE denorm_present 391 #endif 392 393 #if !defined (_STLP_LDBL_DENORM_STYLE) 394 # define _STLP_LDBL_DENORM_STYLE denorm_present 395 #endif 396 397 _STLP_MOVE_TO_STD_NAMESPACE 398 399 _STLP_TEMPLATE_NULL 400 class numeric_limits<float> 401 : public _STLP_PRIV _Floating_limits<float, 402 FLT_MANT_DIG, // Binary digits of precision 403 FLT_DIG, // Decimal digits of precision 404 FLT_MIN_EXP, // Minimum exponent 405 FLT_MAX_EXP, // Maximum exponent 406 FLT_MIN_10_EXP, // Minimum base 10 exponent 407 FLT_MAX_10_EXP, // Maximum base 10 exponent 408 true, 409 _STLP_FLT_DENORM_STYLE, 410 round_to_nearest> { 411 public: 412 static float (_STLP_CALL min) () _STLP_NOTHROW { return FLT_MIN; } denorm_min()413 static float _STLP_CALL denorm_min() _STLP_NOTHROW 414 #if defined (_STLP_FLT_DENORM_MIN) 415 { return _STLP_FLT_DENORM_MIN; } 416 #else 417 { return _STLP_FLT_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_F_denormMin() : FLT_MIN; } 418 #endif 419 static float (_STLP_CALL max) () _STLP_NOTHROW { return FLT_MAX; } epsilon()420 static float _STLP_CALL epsilon() _STLP_NOTHROW { return FLT_EPSILON; } round_error()421 static float _STLP_CALL round_error() _STLP_NOTHROW { return 0.5f; } // Units: ulps. infinity()422 static float _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_inf(); } quiet_NaN()423 static float _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_qNaN(); } signaling_NaN()424 static float _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_sNaN(); } 425 }; 426 427 #undef _STLP_FLT_DENORM_MIN 428 #undef _STLP_FLT_DNORM_STYLE 429 430 _STLP_TEMPLATE_NULL 431 class numeric_limits<double> 432 : public _STLP_PRIV _Floating_limits<double, 433 DBL_MANT_DIG, // Binary digits of precision 434 DBL_DIG, // Decimal digits of precision 435 DBL_MIN_EXP, // Minimum exponent 436 DBL_MAX_EXP, // Maximum exponent 437 DBL_MIN_10_EXP, // Minimum base 10 exponent 438 DBL_MAX_10_EXP, // Maximum base 10 exponent 439 true, 440 _STLP_DBL_DENORM_STYLE, 441 round_to_nearest> { 442 public: 443 static double (_STLP_CALL min)() _STLP_NOTHROW { return DBL_MIN; } denorm_min()444 static double _STLP_CALL denorm_min() _STLP_NOTHROW 445 #if defined (_STLP_DBL_DENORM_MIN) 446 { return _STLP_DBL_DENORM_MIN; } 447 #else 448 { return _STLP_DBL_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_D_denormMin() : DBL_MIN; } 449 #endif 450 static double (_STLP_CALL max)() _STLP_NOTHROW { return DBL_MAX; } epsilon()451 static double _STLP_CALL epsilon() _STLP_NOTHROW { return DBL_EPSILON; } round_error()452 static double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5; } // Units: ulps. infinity()453 static double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_inf(); } quiet_NaN()454 static double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_qNaN(); } signaling_NaN()455 static double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_sNaN(); } 456 }; 457 458 #if !defined (_STLP_NO_LONG_DOUBLE) 459 460 _STLP_TEMPLATE_NULL 461 class numeric_limits<long double> 462 : public _STLP_PRIV _Floating_limits<long double, 463 LDBL_MANT_DIG, // Binary digits of precision 464 LDBL_DIG, // Decimal digits of precision 465 LDBL_MIN_EXP, // Minimum exponent 466 LDBL_MAX_EXP, // Maximum exponent 467 LDBL_MIN_10_EXP,// Minimum base 10 exponent 468 LDBL_MAX_10_EXP,// Maximum base 10 exponent 469 false, // do not conform to iec559 470 _STLP_LDBL_DENORM_STYLE, 471 round_to_nearest> { 472 public: 473 static long double (_STLP_CALL min) () _STLP_NOTHROW { return LDBL_MIN; } denorm_min()474 static long double _STLP_CALL denorm_min() _STLP_NOTHROW 475 #if defined (_STLP_LDBL_DENORM_MIN) 476 { return _STLP_LDBL_DENORM_MIN; } 477 #else 478 { return _STLP_LDBL_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_LD_denormMin() : LDBL_MIN; } 479 #endif 480 _STLP_STATIC_CONSTANT(bool, is_iec559 = false); 481 static long double (_STLP_CALL max) () _STLP_NOTHROW { return LDBL_MAX; } epsilon()482 static long double _STLP_CALL epsilon() _STLP_NOTHROW { return LDBL_EPSILON; } round_error()483 static long double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5l; } infinity()484 static long double _STLP_CALL infinity() _STLP_NOTHROW 485 //For MSVC, long double is nothing more than an alias for double. 486 #if !defined (_STLP_MSVC) 487 { return _STLP_PRIV _LimG<bool>::get_LD_inf(); } 488 #else 489 { return _STLP_PRIV _LimG<bool>::get_D_inf(); } 490 #endif quiet_NaN()491 static long double _STLP_CALL quiet_NaN() _STLP_NOTHROW 492 #if !defined (_STLP_MSVC) 493 { return _STLP_PRIV _LimG<bool>::get_LD_qNaN(); } 494 #else 495 { return _STLP_PRIV _LimG<bool>::get_D_qNaN(); } 496 #endif signaling_NaN()497 static long double _STLP_CALL signaling_NaN() _STLP_NOTHROW 498 #if !defined (_STLP_MSVC) 499 { return _STLP_PRIV _LimG<bool>::get_LD_sNaN(); } 500 #else 501 { return _STLP_PRIV _LimG<bool>::get_D_sNaN(); } 502 #endif 503 }; 504 505 #endif 506 507 // We write special values (Inf and NaN) as bit patterns and 508 // cast the the appropriate floating-point types. 509 _STLP_END_NAMESPACE 510 511 #if !defined (_STLP_LINK_TIME_INSTANTIATION) 512 # include <stl/_limits.c> 513 #endif 514 515 #endif 516 517 // Local Variables: 518 // mode:C++ 519 // End: 520