Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1014 lines
23 KiB

  1. // limits standard header
  2. #pragma once
  3. #ifndef _LIMITS_
  4. #define _LIMITS_
  5. #include <ymath.h>
  6. #include <cfloat>
  7. #include <climits>
  8. #include <cmath>
  9. #include <cwchar>
  10. #include <xstddef>
  11. #pragma pack(push,8)
  12. #pragma warning(push,3)
  13. _STD_BEGIN
  14. // ASSUMES:
  15. // wraparound 2's complement integer arithmetic w/o traps
  16. // all CHAR_BITs of each byte used by integers
  17. // IEC559 (IEEE 754) floating-point arithmetic
  18. // floating-point errors can trap
  19. // tinyness detected before floating-point rounding
  20. // 64-bit long long (if _LONGLONG defined)
  21. // ENUM float_denorm_style
  22. typedef enum
  23. { // constants for different IEEE float denormalization styles
  24. denorm_indeterminate = -1,
  25. denorm_absent = 0,
  26. denorm_present = 1}
  27. float_denorm_style;
  28. // ENUM float_round_style
  29. typedef enum
  30. { // constants for different IEEE rounding styles
  31. round_indeterminate = -1,
  32. round_toward_zero = 0,
  33. round_to_nearest = 1,
  34. round_toward_infinity = 2,
  35. round_toward_neg_infinity = 3}
  36. float_round_style;
  37. // STRUCT _Num_base
  38. struct _CRTIMP2 _Num_base
  39. { // base for all types, with common defaults
  40. _STCONS(float_denorm_style, has_denorm, denorm_absent);
  41. _STCONS(bool, has_denorm_loss, false);
  42. _STCONS(bool, has_infinity, false);
  43. _STCONS(bool, has_quiet_NaN, false);
  44. _STCONS(bool, has_signaling_NaN, false);
  45. _STCONS(bool, is_bounded, false);
  46. _STCONS(bool, is_exact, false);
  47. _STCONS(bool, is_iec559, false);
  48. _STCONS(bool, is_integer, false);
  49. _STCONS(bool, is_modulo, false);
  50. _STCONS(bool, is_signed, false);
  51. _STCONS(bool, is_specialized, false);
  52. _STCONS(bool, tinyness_before, false);
  53. _STCONS(bool, traps, false);
  54. _STCONS(float_round_style, round_style, round_toward_zero);
  55. _STCONS(int, digits, 0);
  56. _STCONS(int, digits10, 0);
  57. _STCONS(int, max_exponent, 0);
  58. _STCONS(int, max_exponent10, 0);
  59. _STCONS(int, min_exponent, 0);
  60. _STCONS(int, min_exponent10, 0);
  61. _STCONS(int, radix, 0);
  62. };
  63. // TEMPLATE CLASS numeric_limits
  64. template<class _Ty>
  65. class numeric_limits
  66. : public _Num_base
  67. { // numeric limits for arbitrary type _Ty (say little or nothing)
  68. public:
  69. static _Ty (__cdecl min)() _THROW0()
  70. { // return minimum value
  71. return (_Ty(0));
  72. }
  73. static _Ty (__cdecl max)() _THROW0()
  74. { // return maximum value
  75. return (_Ty(0));
  76. }
  77. static _Ty __cdecl epsilon() _THROW0()
  78. { // return smallest effective increment from 1.0
  79. return (_Ty(0));
  80. }
  81. static _Ty __cdecl round_error() _THROW0()
  82. { // return largest rounding error
  83. return (_Ty(0));
  84. }
  85. static _Ty __cdecl denorm_min() _THROW0()
  86. { // return minimum denormalized value
  87. return (_Ty(0));
  88. }
  89. static _Ty __cdecl infinity() _THROW0()
  90. { // return positive infinity
  91. return (_Ty(0));
  92. }
  93. static _Ty __cdecl quiet_NaN() _THROW0()
  94. { // return non-signaling NaN
  95. return (_Ty(0));
  96. }
  97. static _Ty __cdecl signaling_NaN() _THROW0()
  98. { // return signaling NaN
  99. return (_Ty(0));
  100. }
  101. };
  102. // STRUCT _Num_int_base
  103. struct _CRTIMP2 _Num_int_base
  104. : public _Num_base
  105. { // base for integer types
  106. _STCONS(bool, is_bounded, true);
  107. _STCONS(bool, is_exact, true);
  108. _STCONS(bool, is_integer, true);
  109. _STCONS(bool, is_modulo, true);
  110. _STCONS(bool, is_specialized, true);
  111. _STCONS(int, radix, 2);
  112. };
  113. // STRUCT _Num_float_base
  114. struct _CRTIMP2 _Num_float_base
  115. : public _Num_base
  116. { // base for floating-point types
  117. _STCONS(float_denorm_style, has_denorm, denorm_present);
  118. _STCONS(bool, has_denorm_loss, true);
  119. _STCONS(bool, has_infinity, true);
  120. _STCONS(bool, has_quiet_NaN, true);
  121. _STCONS(bool, has_signaling_NaN, true);
  122. _STCONS(bool, is_bounded, true);
  123. _STCONS(bool, is_exact, false);
  124. _STCONS(bool, is_iec559, true);
  125. _STCONS(bool, is_integer, false);
  126. _STCONS(bool, is_modulo, false);
  127. _STCONS(bool, is_signed, true);
  128. _STCONS(bool, is_specialized, true);
  129. _STCONS(bool, tinyness_before, true);
  130. _STCONS(bool, traps, true);
  131. _STCONS(float_round_style, round_style, round_to_nearest);
  132. _STCONS(int, radix, FLT_RADIX);
  133. };
  134. // CLASS numeric_limits<char>
  135. template<> class _CRTIMP2 numeric_limits<char>
  136. : public _Num_int_base
  137. { // limits for type char
  138. public:
  139. typedef char _Ty;
  140. static _Ty (__cdecl min)() _THROW0()
  141. { // return minimum value
  142. return (CHAR_MIN);
  143. }
  144. static _Ty (__cdecl max)() _THROW0()
  145. { // return maximum value
  146. return (CHAR_MAX);
  147. }
  148. static _Ty __cdecl epsilon() _THROW0()
  149. { // return smallest effective increment from 1.0
  150. return (0);
  151. }
  152. static _Ty __cdecl round_error() _THROW0()
  153. { // return largest rounding error
  154. return (0);
  155. }
  156. static _Ty __cdecl denorm_min() _THROW0()
  157. { // return minimum denormalized value
  158. return (0);
  159. }
  160. static _Ty __cdecl infinity() _THROW0()
  161. { // return positive infinity
  162. return (0);
  163. }
  164. static _Ty __cdecl quiet_NaN() _THROW0()
  165. { // return non-signaling NaN
  166. return (0);
  167. }
  168. static _Ty __cdecl signaling_NaN() _THROW0()
  169. { // return signaling NaN
  170. return (0);
  171. }
  172. _STCONS(bool, is_signed, CHAR_MIN != 0);
  173. _STCONS(int, digits, CHAR_BIT - (CHAR_MIN != 0 ? 1 : 0));
  174. _STCONS(int, digits10, (CHAR_BIT - (CHAR_MIN != 0 ? 1 : 0))
  175. * 301L / 1000);
  176. };
  177. // CLASS numeric_limits<_Bool>
  178. template<> class _CRTIMP2 numeric_limits<_Bool>
  179. : public _Num_int_base
  180. { // limits for type bool
  181. public:
  182. typedef bool _Ty;
  183. static _Ty (__cdecl min)() _THROW0()
  184. { // return minimum value
  185. return (false);
  186. }
  187. static _Ty (__cdecl max)() _THROW0()
  188. { // return maximum value
  189. return (true);
  190. }
  191. static _Ty __cdecl epsilon() _THROW0()
  192. { // return smallest effective increment from 1.0
  193. return (0);
  194. }
  195. static _Ty __cdecl round_error() _THROW0()
  196. { // return largest rounding error
  197. return (0);
  198. }
  199. static _Ty __cdecl denorm_min() _THROW0()
  200. { // return minimum denormalized value
  201. return (0);
  202. }
  203. static _Ty __cdecl infinity() _THROW0()
  204. { // return positive infinity
  205. return (0);
  206. }
  207. static _Ty __cdecl quiet_NaN() _THROW0()
  208. { // return non-signaling NaN
  209. return (0);
  210. }
  211. static _Ty __cdecl signaling_NaN() _THROW0()
  212. { // return signaling NaN
  213. return (0);
  214. }
  215. _STCONS(bool, is_modulo, false);
  216. _STCONS(bool, is_signed, false);
  217. _STCONS(int, digits, 1);
  218. _STCONS(int, digits10, 0);
  219. };
  220. // CLASS numeric_limits<signed char>
  221. template<> class _CRTIMP2 numeric_limits<signed char>
  222. : public _Num_int_base
  223. { // limits for type signed char
  224. public:
  225. typedef signed char _Ty;
  226. static _Ty (__cdecl min)() _THROW0()
  227. { // return minimum value
  228. return (SCHAR_MIN);
  229. }
  230. static _Ty (__cdecl max)() _THROW0()
  231. { // return maximum value
  232. return (SCHAR_MAX);
  233. }
  234. static _Ty __cdecl epsilon() _THROW0()
  235. { // return smallest effective increment from 1.0
  236. return (0);
  237. }
  238. static _Ty __cdecl round_error() _THROW0()
  239. { // return largest rounding error
  240. return (0);
  241. }
  242. static _Ty __cdecl denorm_min() _THROW0()
  243. { // return minimum denormalized value
  244. return (0);
  245. }
  246. static _Ty __cdecl infinity() _THROW0()
  247. { // return positive infinity
  248. return (0);
  249. }
  250. static _Ty __cdecl quiet_NaN() _THROW0()
  251. { // return non-signaling NaN
  252. return (0);
  253. }
  254. static _Ty __cdecl signaling_NaN() _THROW0()
  255. { // return signaling NaN
  256. return (0);
  257. }
  258. _STCONS(bool, is_signed, true);
  259. _STCONS(int, digits, CHAR_BIT - 1);
  260. _STCONS(int, digits10, (CHAR_BIT - 1) * 301L / 1000);
  261. };
  262. // CLASS numeric_limits<unsigned char>
  263. template<> class _CRTIMP2 numeric_limits<unsigned char>
  264. : public _Num_int_base
  265. { // limits for type unsigned char
  266. public:
  267. typedef unsigned char _Ty;
  268. static _Ty (__cdecl min)() _THROW0()
  269. { // return minimum value
  270. return (0);
  271. }
  272. static _Ty (__cdecl max)() _THROW0()
  273. { // return maximum value
  274. return (UCHAR_MAX);
  275. }
  276. static _Ty __cdecl epsilon() _THROW0()
  277. { // return smallest effective increment from 1.0
  278. return (0);
  279. }
  280. static _Ty __cdecl round_error() _THROW0()
  281. { // return largest rounding error
  282. return (0);
  283. }
  284. static _Ty __cdecl denorm_min() _THROW0()
  285. { // return minimum denormalized value
  286. return (0);
  287. }
  288. static _Ty __cdecl infinity() _THROW0()
  289. { // return positive infinity
  290. return (0);
  291. }
  292. static _Ty __cdecl quiet_NaN() _THROW0()
  293. { // return non-signaling NaN
  294. return (0);
  295. }
  296. static _Ty __cdecl signaling_NaN() _THROW0()
  297. { // return signaling NaN
  298. return (0);
  299. }
  300. _STCONS(bool, is_signed, false);
  301. _STCONS(int, digits, CHAR_BIT);
  302. _STCONS(int, digits10, (CHAR_BIT) * 301L / 1000);
  303. };
  304. // CLASS numeric_limits<short>
  305. template<> class _CRTIMP2 numeric_limits<short>
  306. : public _Num_int_base
  307. { // limits for type short
  308. public:
  309. typedef short _Ty;
  310. static _Ty (__cdecl min)() _THROW0()
  311. { // return minimum value
  312. return (SHRT_MIN);
  313. }
  314. static _Ty (__cdecl max)() _THROW0()
  315. { // return maximum value
  316. return (SHRT_MAX);
  317. }
  318. static _Ty __cdecl epsilon() _THROW0()
  319. { // return smallest effective increment from 1.0
  320. return (0);
  321. }
  322. static _Ty __cdecl round_error() _THROW0()
  323. { // return largest rounding error
  324. return (0);
  325. }
  326. static _Ty __cdecl denorm_min() _THROW0()
  327. { // return minimum denormalized value
  328. return (0);
  329. }
  330. static _Ty __cdecl infinity() _THROW0()
  331. { // return positive infinity
  332. return (0);
  333. }
  334. static _Ty __cdecl quiet_NaN() _THROW0()
  335. { // return non-signaling NaN
  336. return (0);
  337. }
  338. static _Ty __cdecl signaling_NaN() _THROW0()
  339. { // return signaling NaN
  340. return (0);
  341. }
  342. _STCONS(bool, is_signed, true);
  343. _STCONS(int, digits, CHAR_BIT * sizeof (short) - 1);
  344. _STCONS(int, digits10, (CHAR_BIT * sizeof (short) - 1)
  345. * 301L / 1000);
  346. };
  347. // CLASS numeric_limits<unsigned short>
  348. template<> class _CRTIMP2 numeric_limits<unsigned short>
  349. : public _Num_int_base
  350. { // limits for type unsigned short
  351. public:
  352. typedef unsigned short _Ty;
  353. static _Ty (__cdecl min)() _THROW0()
  354. { // return minimum value
  355. return (0);
  356. }
  357. static _Ty (__cdecl max)() _THROW0()
  358. { // return maximum value
  359. return (USHRT_MAX);
  360. }
  361. static _Ty __cdecl epsilon() _THROW0()
  362. { // return smallest effective increment from 1.0
  363. return (0);
  364. }
  365. static _Ty __cdecl round_error() _THROW0()
  366. { // return largest rounding error
  367. return (0);
  368. }
  369. static _Ty __cdecl denorm_min() _THROW0()
  370. { // return minimum denormalized value
  371. return (0);
  372. }
  373. static _Ty __cdecl infinity() _THROW0()
  374. { // return positive infinity
  375. return (0);
  376. }
  377. static _Ty __cdecl quiet_NaN() _THROW0()
  378. { // return non-signaling NaN
  379. return (0);
  380. }
  381. static _Ty __cdecl signaling_NaN() _THROW0()
  382. { // return signaling NaN
  383. return (0);
  384. }
  385. _STCONS(bool, is_signed, false);
  386. _STCONS(int, digits, CHAR_BIT * sizeof (unsigned short));
  387. _STCONS(int, digits10, (CHAR_BIT * sizeof (unsigned short))
  388. * 301L / 1000);
  389. };
  390. #ifdef _NATIVE_WCHAR_T_DEFINED
  391. // CLASS numeric_limits<wchar_t>
  392. template<> class _CRTIMP2 numeric_limits<wchar_t>
  393. : public _Num_int_base
  394. { // limits for type wchar_t
  395. public:
  396. typedef wchar_t _Ty;
  397. static _Ty (__cdecl min)() _THROW0()
  398. { // return minimum value
  399. return (0);
  400. }
  401. static _Ty (__cdecl max)() _THROW0()
  402. { // return maximum value
  403. return (USHRT_MAX);
  404. }
  405. static _Ty __cdecl epsilon() _THROW0()
  406. { // return smallest effective increment from 1.0
  407. return (0);
  408. }
  409. static _Ty __cdecl round_error() _THROW0()
  410. { // return largest rounding error
  411. return (0);
  412. }
  413. static _Ty __cdecl denorm_min() _THROW0()
  414. { // return minimum denormalized value
  415. return (0);
  416. }
  417. static _Ty __cdecl infinity() _THROW0()
  418. { // return positive infinity
  419. return (0);
  420. }
  421. static _Ty __cdecl quiet_NaN() _THROW0()
  422. { // return non-signaling NaN
  423. return (0);
  424. }
  425. static _Ty __cdecl signaling_NaN() _THROW0()
  426. { // return signaling NaN
  427. return (0);
  428. }
  429. _STCONS(bool, is_signed, false);
  430. _STCONS(int, digits, CHAR_BIT * sizeof (wchar_t));
  431. _STCONS(int, digits10, (CHAR_BIT * sizeof (wchar_t))
  432. * 301L / 1000);
  433. };
  434. #endif
  435. // CLASS numeric_limits<int>
  436. template<> class _CRTIMP2 numeric_limits<int>
  437. : public _Num_int_base
  438. { // limits for type int
  439. public:
  440. typedef int _Ty;
  441. static _Ty (__cdecl min)() _THROW0()
  442. { // return minimum value
  443. return (INT_MIN);
  444. }
  445. static _Ty (__cdecl max)() _THROW0()
  446. { // return maximum value
  447. return (INT_MAX);
  448. }
  449. static _Ty __cdecl epsilon() _THROW0()
  450. { // return smallest effective increment from 1.0
  451. return (0);
  452. }
  453. static _Ty __cdecl round_error() _THROW0()
  454. { // return largest rounding error
  455. return (0);
  456. }
  457. static _Ty __cdecl denorm_min() _THROW0()
  458. { // return minimum denormalized value
  459. return (0);
  460. }
  461. static _Ty __cdecl infinity() _THROW0()
  462. { // return positive infinity
  463. return (0);
  464. }
  465. static _Ty __cdecl quiet_NaN() _THROW0()
  466. { // return non-signaling NaN
  467. return (0);
  468. }
  469. static _Ty __cdecl signaling_NaN() _THROW0()
  470. { // return signaling NaN
  471. return (0);
  472. }
  473. _STCONS(bool, is_signed, true);
  474. _STCONS(int, digits, CHAR_BIT * sizeof (int) - 1);
  475. _STCONS(int, digits10, (CHAR_BIT * sizeof (int) - 1)
  476. * 301L / 1000);
  477. };
  478. // CLASS numeric_limits<unsigned int>
  479. template<> class _CRTIMP2 numeric_limits<unsigned int>
  480. : public _Num_int_base
  481. { // limits for type unsigned int
  482. public:
  483. typedef unsigned int _Ty;
  484. static _Ty (__cdecl min)() _THROW0()
  485. { // return minimum value
  486. return (0);
  487. }
  488. static _Ty (__cdecl max)() _THROW0()
  489. { // return maximum value
  490. return (UINT_MAX);
  491. }
  492. static _Ty __cdecl epsilon() _THROW0()
  493. { // return smallest effective increment from 1.0
  494. return (0);
  495. }
  496. static _Ty __cdecl round_error() _THROW0()
  497. { // return largest rounding error
  498. return (0);
  499. }
  500. static _Ty __cdecl denorm_min() _THROW0()
  501. { // return minimum denormalized value
  502. return (0);
  503. }
  504. static _Ty __cdecl infinity() _THROW0()
  505. { // return positive infinity
  506. return (0);
  507. }
  508. static _Ty __cdecl quiet_NaN() _THROW0()
  509. { // return non-signaling NaN
  510. return (0);
  511. }
  512. static _Ty __cdecl signaling_NaN() _THROW0()
  513. { // return signaling NaN
  514. return (0);
  515. }
  516. _STCONS(bool, is_signed, false);
  517. _STCONS(int, digits, CHAR_BIT * sizeof (unsigned int));
  518. _STCONS(int, digits10, (CHAR_BIT * sizeof (unsigned int))
  519. * 301L / 1000);
  520. };
  521. // CLASS numeric_limits<long>
  522. template<> class _CRTIMP2 numeric_limits<long>
  523. : public _Num_int_base
  524. { // limits for type long
  525. public:
  526. typedef long _Ty;
  527. static _Ty (__cdecl min)() _THROW0()
  528. { // return minimum value
  529. return (LONG_MIN);
  530. }
  531. static _Ty (__cdecl max)() _THROW0()
  532. { // return maximum value
  533. return (LONG_MAX);
  534. }
  535. static _Ty __cdecl epsilon() _THROW0()
  536. { // return smallest effective increment from 1.0
  537. return (0);
  538. }
  539. static _Ty __cdecl round_error() _THROW0()
  540. { // return largest rounding error
  541. return (0);
  542. }
  543. static _Ty __cdecl denorm_min() _THROW0()
  544. { // return minimum denormalized value
  545. return (0);
  546. }
  547. static _Ty __cdecl infinity() _THROW0()
  548. { // return positive infinity
  549. return (0);
  550. }
  551. static _Ty __cdecl quiet_NaN() _THROW0()
  552. { // return non-signaling NaN
  553. return (0);
  554. }
  555. static _Ty __cdecl signaling_NaN() _THROW0()
  556. { // return signaling NaN
  557. return (0);
  558. }
  559. _STCONS(bool, is_signed, true);
  560. _STCONS(int, digits, CHAR_BIT * sizeof (long) - 1);
  561. _STCONS(int, digits10, (CHAR_BIT * sizeof (long) - 1)
  562. * 301L / 1000);
  563. };
  564. // CLASS numeric_limits<unsigned long>
  565. template<> class _CRTIMP2 numeric_limits<unsigned long>
  566. : public _Num_int_base
  567. { // limits for type unsigned long
  568. public:
  569. typedef unsigned long _Ty;
  570. static _Ty (__cdecl min)() _THROW0()
  571. { // return minimum value
  572. return (0);
  573. }
  574. static _Ty (__cdecl max)() _THROW0()
  575. { // return maximum value
  576. return (ULONG_MAX);
  577. }
  578. static _Ty __cdecl epsilon() _THROW0()
  579. { // return smallest effective increment from 1.0
  580. return (0);
  581. }
  582. static _Ty __cdecl round_error() _THROW0()
  583. { // return largest rounding error
  584. return (0);
  585. }
  586. static _Ty __cdecl denorm_min() _THROW0()
  587. { // return minimum denormalized value
  588. return (0);
  589. }
  590. static _Ty __cdecl infinity() _THROW0()
  591. { // return positive infinity
  592. return (0);
  593. }
  594. static _Ty __cdecl quiet_NaN() _THROW0()
  595. { // return non-signaling NaN
  596. return (0);
  597. }
  598. static _Ty __cdecl signaling_NaN() _THROW0()
  599. { // return signaling NaN
  600. return (0);
  601. }
  602. _STCONS(bool, is_signed, false);
  603. _STCONS(int, digits, CHAR_BIT * sizeof (unsigned long));
  604. _STCONS(int, digits10, (CHAR_BIT * sizeof (unsigned long))
  605. * 301L / 1000);
  606. };
  607. #ifdef _LONGLONG
  608. // CLASS numeric_limits<_LONGLONG>
  609. template<> class _CRTIMP2 numeric_limits<_LONGLONG>
  610. : public _Num_int_base
  611. { // limits for type long long
  612. public:
  613. typedef _LONGLONG _Ty;
  614. static _Ty (__cdecl min)() _THROW0()
  615. { // return minimum value
  616. return (-_LLONG_MAX - _C2);
  617. }
  618. static _Ty (__cdecl max)() _THROW0()
  619. { // return maximum value
  620. return (_LLONG_MAX);
  621. }
  622. static _Ty __cdecl epsilon() _THROW0()
  623. { // return smallest effective increment from 1.0
  624. return (0);
  625. }
  626. static _Ty __cdecl round_error() _THROW0()
  627. { // return largest rounding error
  628. return (0);
  629. }
  630. static _Ty __cdecl denorm_min() _THROW0()
  631. { // return minimum denormalized value
  632. return (0);
  633. }
  634. static _Ty __cdecl infinity() _THROW0()
  635. { // return positive infinity
  636. return (0);
  637. }
  638. static _Ty __cdecl quiet_NaN() _THROW0()
  639. { // return non-signaling NaN
  640. return (0);
  641. }
  642. static _Ty __cdecl signaling_NaN() _THROW0()
  643. { // return signaling NaN
  644. return (0);
  645. }
  646. _STCONS(bool, is_signed, true);
  647. _STCONS(int, digits, CHAR_BIT * sizeof (_LONGLONG) - 1);
  648. _STCONS(int, digits10, (CHAR_BIT * sizeof (_LONGLONG) - 1)
  649. * 301L / 1000);
  650. };
  651. // CLASS numeric_limits<_ULONGLONG>
  652. template<> class _CRTIMP2 numeric_limits<_ULONGLONG>
  653. : public _Num_int_base
  654. { // limits for type unsigned long long
  655. public:
  656. typedef _ULONGLONG _Ty;
  657. static _Ty (__cdecl min)() _THROW0()
  658. { // return minimum value
  659. return (0);
  660. }
  661. static _Ty (__cdecl max)() _THROW0()
  662. { // return maximum value
  663. return (_ULLONG_MAX);
  664. }
  665. static _Ty __cdecl epsilon() _THROW0()
  666. { // return smallest effective increment from 1.0
  667. return (0);
  668. }
  669. static _Ty __cdecl round_error() _THROW0()
  670. { // return largest rounding error
  671. return (0);
  672. }
  673. static _Ty __cdecl denorm_min() _THROW0()
  674. { // return minimum denormalized value
  675. return (0);
  676. }
  677. static _Ty __cdecl infinity() _THROW0()
  678. { // return positive infinity
  679. return (0);
  680. }
  681. static _Ty __cdecl quiet_NaN() _THROW0()
  682. { // return non-signaling NaN
  683. return (0);
  684. }
  685. static _Ty __cdecl signaling_NaN() _THROW0()
  686. { // return signaling NaN
  687. return (0);
  688. }
  689. _STCONS(bool, is_signed, false);
  690. _STCONS(int, digits, CHAR_BIT * sizeof (_ULONGLONG));
  691. _STCONS(int, digits10, (CHAR_BIT * sizeof (_ULONGLONG))
  692. * 301L / 1000);
  693. };
  694. #endif /* _LONGLONG */
  695. // CLASS numeric_limits<float>
  696. template<> class _CRTIMP2 numeric_limits<float>
  697. : public _Num_float_base
  698. { // limits for type float
  699. public:
  700. typedef float _Ty;
  701. static _Ty (__cdecl min)() _THROW0()
  702. { // return minimum value
  703. return (FLT_MIN);
  704. }
  705. static _Ty (__cdecl max)() _THROW0()
  706. { // return maximum value
  707. return (FLT_MAX);
  708. }
  709. static _Ty __cdecl epsilon() _THROW0()
  710. { // return smallest effective increment from 1.0
  711. return (FLT_EPSILON);
  712. }
  713. static _Ty __cdecl round_error() _THROW0()
  714. { // return largest rounding error
  715. return (0.5);
  716. }
  717. static _Ty __cdecl denorm_min() _THROW0()
  718. { // return minimum denormalized value
  719. return (_FDenorm._Float);
  720. }
  721. static _Ty __cdecl infinity() _THROW0()
  722. { // return positive infinity
  723. return (_FInf._Float);
  724. }
  725. static _Ty __cdecl quiet_NaN() _THROW0()
  726. { // return non-signaling NaN
  727. return (_FNan._Float);
  728. }
  729. static _Ty __cdecl signaling_NaN() _THROW0()
  730. { // return signaling NaN
  731. return (_FSnan._Float);
  732. }
  733. _STCONS(int, digits, FLT_MANT_DIG);
  734. _STCONS(int, digits10, FLT_DIG);
  735. _STCONS(int, max_exponent, (int)FLT_MAX_EXP);
  736. _STCONS(int, max_exponent10, (int)FLT_MAX_10_EXP);
  737. _STCONS(int, min_exponent, (int)FLT_MIN_EXP);
  738. _STCONS(int, min_exponent10, (int)FLT_MIN_10_EXP);
  739. };
  740. // CLASS numeric_limits<double>
  741. template<> class _CRTIMP2 numeric_limits<double>
  742. : public _Num_float_base
  743. { // limits for type double
  744. public:
  745. typedef double _Ty;
  746. static _Ty (__cdecl min)() _THROW0()
  747. { // return minimum value
  748. return (DBL_MIN);
  749. }
  750. static _Ty (__cdecl max)() _THROW0()
  751. { // return maximum value
  752. return (DBL_MAX);
  753. }
  754. static _Ty __cdecl epsilon() _THROW0()
  755. { // return smallest effective increment from 1.0
  756. return (DBL_EPSILON);
  757. }
  758. static _Ty __cdecl round_error() _THROW0()
  759. { // return largest rounding error
  760. return (0.5);
  761. }
  762. static _Ty __cdecl denorm_min() _THROW0()
  763. { // return minimum denormalized value
  764. return (_Denorm._Double);
  765. }
  766. static _Ty __cdecl infinity() _THROW0()
  767. { // return positive infinity
  768. return (_Inf._Double);
  769. }
  770. static _Ty __cdecl quiet_NaN() _THROW0()
  771. { // return non-signaling NaN
  772. return (_Nan._Double);
  773. }
  774. static _Ty __cdecl signaling_NaN() _THROW0()
  775. { // return signaling NaN
  776. return (_Snan._Double);
  777. }
  778. _STCONS(int, digits, DBL_MANT_DIG);
  779. _STCONS(int, digits10, DBL_DIG);
  780. _STCONS(int, max_exponent, (int)DBL_MAX_EXP);
  781. _STCONS(int, max_exponent10, (int)DBL_MAX_10_EXP);
  782. _STCONS(int, min_exponent, (int)DBL_MIN_EXP);
  783. _STCONS(int, min_exponent10, (int)DBL_MIN_10_EXP);
  784. };
  785. // CLASS numeric_limits<long double>
  786. template<> class _CRTIMP2 numeric_limits<long double>
  787. : public _Num_float_base
  788. { // limits for type long double
  789. public:
  790. typedef long double _Ty;
  791. static _Ty (__cdecl min)() _THROW0()
  792. { // return minimum value
  793. return (LDBL_MIN);
  794. }
  795. static _Ty (__cdecl max)() _THROW0()
  796. { // return maximum value
  797. return (LDBL_MAX);
  798. }
  799. static _Ty __cdecl epsilon() _THROW0()
  800. { // return smallest effective increment from 1.0
  801. return (LDBL_EPSILON);
  802. }
  803. static _Ty __cdecl round_error() _THROW0()
  804. { // return largest rounding error
  805. return (0.5);
  806. }
  807. static _Ty __cdecl denorm_min() _THROW0()
  808. { // return minimum denormalized value
  809. return (_LDenorm._Long_double);
  810. }
  811. static _Ty __cdecl infinity() _THROW0()
  812. { // return positive infinity
  813. return (_LInf._Long_double);
  814. }
  815. static _Ty __cdecl quiet_NaN() _THROW0()
  816. { // return non-signaling NaN
  817. return (_LNan._Long_double);
  818. }
  819. static _Ty __cdecl signaling_NaN() _THROW0()
  820. { // return signaling NaN
  821. return (_LSnan._Long_double);
  822. }
  823. _STCONS(int, digits, LDBL_MANT_DIG);
  824. _STCONS(int, digits10, LDBL_DIG);
  825. _STCONS(int, max_exponent, (int)LDBL_MAX_EXP);
  826. _STCONS(int, max_exponent10, (int)LDBL_MAX_10_EXP);
  827. _STCONS(int, min_exponent, (int)LDBL_MIN_EXP);
  828. _STCONS(int, min_exponent10, (int)LDBL_MIN_10_EXP);
  829. };
  830. _STD_END
  831. #pragma warning(pop)
  832. #pragma pack(pop)
  833. #endif /* _LIMITS_ */
  834. /*
  835. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  836. * Consult your license regarding permissions and restrictions.
  837. V3.10:0009 */