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