xref: /reactos/sdk/include/c++/limits (revision 40462c92)
1// Numerical limits for C++
2
3#include <climits>
4#include <cwchar>
5#include <cfloat>
6#include <ymath.h>
7
8namespace std
9{
10    // Rounding style for floating point numbers
11    enum float_round_style {
12        round_indeterminate = -1,
13        round_toward_zero = 0,
14        round_to_nearest = 1,
15        round_toward_infinity = 2,
16        round_toward_neg_infinity = 3
17        };
18
19    // How to represent denormalized values
20    enum float_denorm_style {
21        denorm_indeterminate = -1,
22        denorm_absent = 0,
23        denorm_present = 1
24        };
25
26    template<class Type> class numeric_limits
27    {
28    public:
29        // Not specialized by default
30        static const bool is_specialized = false;
31
32        // Bounding
33        static const bool is_bounded = false;
34        static Type lowest() throw();
35        static Type max( ) throw( );
36        static Type min( ) throw( );
37
38        // infinity
39        static const bool has_infinity = false;
40        static Type infinity( ) throw( );
41
42        // Denormalization
43        static const float_denorm_style has_denorm = denorm_absent;
44        static const bool has_denorm_loss = false;
45        static Type denorm_min( ) throw( );
46
47        // Digits
48        static const int digits = 0;
49        static const int digits10 = 0;
50
51        // NaN
52        static const bool has_quiet_NaN = false;
53        static const bool has_signaling_NaN = false;
54        static Type quiet_NaN( ) throw( );
55        static Type signaling_NaN( ) throw( );
56
57        // Information
58        static const bool is_exact = false;
59        static const bool is_iec559 = false;
60        static const bool is_integer = false;
61        static const bool is_modulo = false;
62        static const bool is_signed = false;
63
64        // misc
65        static Type epsilon( ) throw( );
66        static const int max_digits10 = 0;
67        static const int radix = 0;
68        static const bool traps = false;
69
70        // exponent
71        static const int max_exponent = 0;
72        static const int max_exponent10 = 0;
73        static const int min_exponent = 0;
74        static const int min_exponent10 = 0;
75
76        // rounding
77        static Type round_error( ) throw( );
78        static const float_round_style round_style = round_toward_zero;
79        static const bool tinyness_before = false;
80    };
81
82    template<> class numeric_limits<wchar_t>
83    {
84        static const bool is_specialized = true;
85
86        // Bounding
87        static const bool is_bounded = true;
88        static wchar_t lowest() throw()
89            {return WCHAR_MIN;}
90        static wchar_t max( ) throw()
91            {return WCHAR_MAX;}
92        static wchar_t min( ) throw()
93            {return WCHAR_MIN;}
94
95        // infinity
96        static const bool has_infinity = false;
97        static wchar_t infinity( ) throw()
98            {return 0;}
99
100        // Denormalization
101        static const float_denorm_style has_denorm = denorm_absent;
102        static const bool has_denorm_loss = false;
103        static wchar_t denorm_min( ) throw()
104            {return 0;}
105
106        // Digits
107        static const bool is_signed = WCHAR_MIN != 0;
108        static const int digits = sizeof(wchar_t) * CHAR_BIT - (is_signed ? 1 : 0);
109        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
110        static const int digits10 = digits * 643 / 2136;
111
112        // NaN
113        static wchar_t quiet_NaN( ) throw()
114            {return 0;}
115        static wchar_t signaling_NaN( ) throw()
116            {return 0;}
117
118
119        // Information
120        static const bool is_exact = true;
121        static const bool is_iec559 = false;
122        static const bool is_integer = true;
123        static const bool is_modulo = true;
124
125        // misc
126        static wchar_t epsilon( ) throw()
127            {return 0;}
128        static const int max_digits10 = 0;
129        static const int radix = 2;
130        static const bool traps = false;
131
132        // exponent
133        static const int max_exponent = 0;
134        static const int max_exponent10 = 0;
135        static const int min_exponent = 0;
136        static const int min_exponent10 = 0;
137
138        // rounding
139        static wchar_t round_error( ) throw( )
140            {return 0;}
141        static const float_round_style round_style = round_toward_zero;
142        static const bool tinyness_before = false;
143    };
144
145    template<> class numeric_limits<bool>
146    {
147    public:
148        static const bool is_specialized = true;
149
150        // Bounding
151        static const bool is_bounded = true;
152        static bool lowest() throw()
153            {return false;}
154        static bool max( ) throw( )
155            {return true;}
156        static bool min( ) throw( )
157            {return false;}
158
159        // infinity
160        static const bool has_infinity = false;
161        static bool infinity( ) throw( )
162            {return false;}
163
164        // Denormalization
165        static const float_denorm_style has_denorm = denorm_absent;
166        static const bool has_denorm_loss = false;
167        static bool denorm_min( ) throw( )
168            {return false;}
169
170        // Digits
171        static const int digits = 1;
172        static const int digits10 = 0;
173
174        // NaN
175        static const bool has_quiet_NaN = false;
176        static const bool has_signaling_NaN = false;
177        static bool quiet_NaN( ) throw( )
178            {return false;}
179        static bool signaling_NaN( ) throw( )
180            {return false;}
181
182        // Information
183        static const bool is_exact = true;
184        static const bool is_iec559 = false;
185        static const bool is_integer = true;
186        static const bool is_modulo = false;
187        static const bool is_signed = false;
188
189        // misc
190        static bool epsilon( ) throw( )
191            {return false;}
192        static const int max_digits10 = 0;
193        static const int radix = 2;
194        static const bool traps = false;
195
196        // exponent
197        static const int max_exponent = 0;
198        static const int max_exponent10 = 0;
199        static const int min_exponent = 0;
200        static const int min_exponent10 = 0;
201
202        // rounding
203        static bool round_error( ) throw( )
204            {return false;}
205        static const float_round_style round_style = round_toward_zero;
206        static const bool tinyness_before = false;
207    };
208
209    template<> class numeric_limits<char>
210    {
211    public:
212        static const bool is_specialized = true;
213
214        // Bounding
215        static const bool is_bounded = true;
216        static char lowest() throw()
217            {return CHAR_MIN;}
218        static char max( ) throw( )
219            {return CHAR_MAX;}
220        static char min( ) throw( )
221            {return CHAR_MIN;}
222
223        // infinity
224        static const bool has_infinity = false;
225        static char infinity( ) throw( )
226            {return 0;}
227
228        // Denormalization
229        static const float_denorm_style has_denorm = denorm_absent;
230        static const bool has_denorm_loss = false;
231        static char denorm_min( ) throw( )
232            {return 0;}
233
234        // Digits
235        static const bool is_signed = CHAR_MIN != 0;
236        static const int digits = sizeof(char) * CHAR_BIT - (is_signed ? 1 : 0);
237        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
238        static const int digits10 = digits * 643 / 2136;
239
240        // NaN
241        static const bool has_quiet_NaN = false;
242        static const bool has_signaling_NaN = false;
243        static char quiet_NaN( ) throw( )
244            {return 0;}
245        static char signaling_NaN( ) throw( )
246            {return 0;}
247
248        // Information
249        static const bool is_exact = true;
250        static const bool is_iec559 = false;
251        static const bool is_integer = true;
252        static const bool is_modulo = true;
253
254        // misc
255        static char epsilon( ) throw( )
256            {return 0;}
257        static const int max_digits10 = 0;
258        static const int radix = 2;
259        static const bool traps = false;
260
261        // exponent
262        static const int max_exponent = 0;
263        static const int max_exponent10 = 0;
264        static const int min_exponent = 0;
265        static const int min_exponent10 = 0;
266
267        // rounding
268        static char round_error( ) throw( )
269            {return 0;}
270        static const float_round_style round_style = round_toward_zero;
271        static const bool tinyness_before = false;
272    };
273
274    template<> class numeric_limits<signed char>
275    {
276    public:
277        static const bool is_specialized = true;
278
279        // Bounding
280        static const bool is_bounded = true;
281        static signed char lowest() throw()
282            {return SCHAR_MIN;}
283        static signed char max( ) throw( )
284            {return SCHAR_MAX;}
285        static signed char min( ) throw( )
286            {return SCHAR_MIN;}
287
288        // infinity
289        static const bool has_infinity = false;
290        static signed char infinity( ) throw( )
291            {return 0;}
292
293        // Denormalization
294        static const float_denorm_style has_denorm = denorm_absent;
295        static const bool has_denorm_loss = false;
296        static signed char denorm_min( ) throw( )
297            {return 0;}
298
299        // Digits
300        static const int digits = sizeof(signed char) * CHAR_BIT - 1;
301        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
302        static const int digits10 = digits * 643 / 2136;
303
304        // NaN
305        static const bool has_quiet_NaN = false;
306        static const bool has_signaling_NaN = false;
307        static signed char quiet_NaN( ) throw( )
308            {return 0;}
309        static signed char signaling_NaN( ) throw( )
310            {return 0;}
311
312        // Information
313        static const bool is_exact = true;
314        static const bool is_iec559 = false;
315        static const bool is_integer = true;
316        static const bool is_modulo = true;
317        static const bool is_signed = true;
318
319        // misc
320        static signed char epsilon( ) throw( )
321            {return 0;}
322        static const int max_digits10 = 0;
323        static const int radix = 2;
324        static const bool traps = false;
325
326        // exponent
327        static const int max_exponent = 0;
328        static const int max_exponent10 = 0;
329        static const int min_exponent = 0;
330        static const int min_exponent10 = 0;
331
332        // rounding
333        static signed char round_error( ) throw( )
334            {return 0;}
335        static const float_round_style round_style = round_toward_zero;
336        static const bool tinyness_before = false;
337    };
338
339    template<> class numeric_limits<unsigned char>
340    {
341    public:
342        static const bool is_specialized = true;
343
344        // Bounding
345        static const bool is_bounded = true;
346        static unsigned char lowest() throw()
347            {return 0;}
348        static unsigned char max( ) throw( )
349            {return UCHAR_MAX;}
350        static unsigned char min( ) throw( )
351            {return 0;}
352
353        // infinity
354        static const bool has_infinity = false;
355        static unsigned char infinity( ) throw( )
356            {return 0;}
357
358        // Denormalization
359        static const float_denorm_style has_denorm = denorm_absent;
360        static const bool has_denorm_loss = false;
361        static unsigned char denorm_min( ) throw( )
362            {return 0;}
363
364        // Digits
365        static const int digits = sizeof(unsigned char) * CHAR_BIT;
366        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
367        static const int digits10 = digits * 643 / 2136;
368
369        // NaN
370        static const bool has_quiet_NaN = false;
371        static const bool has_signaling_NaN = false;
372        static unsigned char quiet_NaN( ) throw( )
373            {return 0;}
374        static unsigned char signaling_NaN( ) throw( )
375            {return 0;}
376
377        // Information
378        static const bool is_exact = true;
379        static const bool is_iec559 = false;
380        static const bool is_integer = true;
381        static const bool is_modulo = true;
382        static const bool is_signed = false;
383
384        // misc
385        static unsigned char epsilon( ) throw( )
386            {return 0;}
387        static const int max_digits10 = 0;
388        static const int radix = 2;
389        static const bool traps = false;
390
391        // exponent
392        static const int max_exponent = 0;
393        static const int max_exponent10 = 0;
394        static const int min_exponent = 0;
395        static const int min_exponent10 = 0;
396
397        // rounding
398        static unsigned char round_error( ) throw( )
399            {return 0;}
400        static const float_round_style round_style = round_toward_zero;
401        static const bool tinyness_before = false;
402    };
403
404    template<> class numeric_limits<short>
405    {
406    public:
407        static const bool is_specialized = true;
408
409        // Bounding
410        static const bool is_bounded = true;
411        static short lowest() throw()
412            {return SHRT_MIN;}
413        static short max( ) throw( )
414            {return SHRT_MAX;}
415        static short min( ) throw( )
416            {return SHRT_MIN;}
417
418        // infinity
419        static const bool has_infinity = false;
420        static short infinity( ) throw( )
421            {return 0;}
422
423        // Denormalization
424        static const float_denorm_style has_denorm = denorm_absent;
425        static const bool has_denorm_loss = false;
426        static short denorm_min( ) throw( )
427            {return 0;}
428
429        // Digits
430        static const bool is_signed = SHRT_MIN != 0;
431        static const int digits = sizeof(short) * CHAR_BIT - (is_signed ? 1 : 0);
432        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
433        static const int digits10 = digits * 643 / 2136;
434
435        // NaN
436        static const bool has_quiet_NaN = false;
437        static const bool has_signaling_NaN = false;
438        static short quiet_NaN( ) throw( )
439            {return 0;}
440        static short signaling_NaN( ) throw( )
441            {return 0;}
442
443        // Information
444        static const bool is_exact = true;
445        static const bool is_iec559 = false;
446        static const bool is_integer = true;
447        static const bool is_modulo = true;
448
449        // misc
450        static short epsilon( ) throw( )
451            {return 0;}
452        static const int max_digits10 = 0;
453        static const int radix = 2;
454        static const bool traps = false;
455
456        // exponent
457        static const int max_exponent = 0;
458        static const int max_exponent10 = 0;
459        static const int min_exponent = 0;
460        static const int min_exponent10 = 0;
461
462        // rounding
463        static short round_error( ) throw( )
464            {return 0;}
465        static const float_round_style round_style = round_toward_zero;
466        static const bool tinyness_before = false;
467    };
468
469    template<> class numeric_limits<unsigned short>
470    {
471    public:
472        static const bool is_specialized = true;
473
474        // Bounding
475        static const bool is_bounded = true;
476        static unsigned short lowest() throw()
477            {return 0;}
478        static unsigned short max( ) throw( )
479            {return USHRT_MAX;}
480        static unsigned short min( ) throw( )
481            {return 0;}
482
483        // infinity
484        static const bool has_infinity = false;
485        static unsigned short infinity( ) throw( )
486            {return 0;}
487
488        // Denormalization
489        static const float_denorm_style has_denorm = denorm_absent;
490        static const bool has_denorm_loss = false;
491        static unsigned short denorm_min( ) throw( )
492            {return 0;}
493
494        // Digits
495        static const int digits = sizeof(unsigned short) * CHAR_BIT;
496        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
497        static const int digits10 = digits * 643 / 2136;
498
499        // NaN
500        static const bool has_quiet_NaN = false;
501        static const bool has_signaling_NaN = false;
502        static unsigned short quiet_NaN( ) throw( )
503            {return 0;}
504        static unsigned short signaling_NaN( ) throw( )
505            {return 0;}
506
507        // Information
508        static const bool is_exact = true;
509        static const bool is_iec559 = false;
510        static const bool is_integer = true;
511        static const bool is_modulo = true;
512        static const bool is_signed = false;
513
514        // misc
515        static unsigned short epsilon( ) throw( )
516            {return 0;}
517        static const int max_digits10 = 0;
518        static const int radix = 2;
519        static const bool traps = false;
520
521        // exponent
522        static const int max_exponent = 0;
523        static const int max_exponent10 = 0;
524        static const int min_exponent = 0;
525        static const int min_exponent10 = 0;
526
527        // rounding
528        static unsigned short round_error( ) throw( )
529            {return 0;}
530        static const float_round_style round_style = round_toward_zero;
531        static const bool tinyness_before = false;
532    };
533
534    template<> class numeric_limits<int>
535    {
536    public:
537        static const bool is_specialized = true;
538
539        // Bounding
540        static const bool is_bounded = true;
541        static int lowest() throw()
542            {return INT_MIN;}
543        static int max( ) throw( )
544            {return INT_MAX;}
545        static int min( ) throw( )
546            {return INT_MIN;}
547
548        // infinity
549        static const bool has_infinity = false;
550        static int infinity( ) throw( )
551            {return 0;}
552
553        // Denormalization
554        static const float_denorm_style has_denorm = denorm_absent;
555        static const bool has_denorm_loss = false;
556        static int denorm_min( ) throw( )
557            {return 0;}
558
559        // Digits
560        static const bool is_signed = INT_MIN != 0;
561        static const int digits = sizeof(int) * CHAR_BIT - (is_signed ? 1 : 0);
562        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
563        static const int digits10 = digits * 643 / 2136;
564
565        // NaN
566        static const bool has_quiet_NaN = false;
567        static const bool has_signaling_NaN = false;
568        static int quiet_NaN( ) throw( )
569            {return 0;}
570        static int signaling_NaN( ) throw( )
571            {return 0;}
572
573        // Information
574        static const bool is_exact = true;
575        static const bool is_iec559 = false;
576        static const bool is_integer = true;
577        static const bool is_modulo = true;
578
579        // misc
580        static int epsilon( ) throw( )
581            {return 0;}
582        static const int max_digits10 = 0;
583        static const int radix = 2;
584        static const bool traps = false;
585
586        // exponent
587        static const int max_exponent = 0;
588        static const int max_exponent10 = 0;
589        static const int min_exponent = 0;
590        static const int min_exponent10 = 0;
591
592        // rounding
593        static int round_error( ) throw( )
594            {return 0;}
595        static const float_round_style round_style = round_toward_zero;
596        static const bool tinyness_before = false;
597    };
598
599    template<> class numeric_limits<unsigned int>
600    {
601    public:
602        static const bool is_specialized = true;
603
604        // Bounding
605        static const bool is_bounded = true;
606        static unsigned int lowest() throw()
607            {return 0;}
608        static unsigned int max( ) throw( )
609            {return UINT_MAX;}
610        static unsigned int min( ) throw( )
611            {return 0;}
612
613        // infinity
614        static const bool has_infinity = false;
615        static unsigned int infinity( ) throw( )
616            {return 0;}
617
618        // Denormalization
619        static const float_denorm_style has_denorm = denorm_absent;
620        static const bool has_denorm_loss = false;
621        static unsigned int denorm_min( ) throw( )
622            {return 0;}
623
624        // Digits
625        static const int digits = sizeof(unsigned int) * CHAR_BIT;
626        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
627        static const int digits10 = digits * 643 / 2136;
628
629        // NaN
630        static const bool has_quiet_NaN = false;
631        static const bool has_signaling_NaN = false;
632        static unsigned int quiet_NaN( ) throw( )
633            {return 0;}
634        static unsigned int signaling_NaN( ) throw( )
635            {return 0;}
636
637        // Information
638        static const bool is_exact = true;
639        static const bool is_iec559 = false;
640        static const bool is_integer = true;
641        static const bool is_modulo = true;
642        static const bool is_signed = false;
643
644        // misc
645        static unsigned int epsilon( ) throw( )
646            {return 0;}
647        static const int max_digits10 = 0;
648        static const int radix = 2;
649        static const bool traps = false;
650
651        // exponent
652        static const int max_exponent = 0;
653        static const int max_exponent10 = 0;
654        static const int min_exponent = 0;
655        static const int min_exponent10 = 0;
656
657        // rounding
658        static unsigned int round_error( ) throw( )
659            {return 0;}
660        static const float_round_style round_style = round_toward_zero;
661        static const bool tinyness_before = false;
662    };
663
664    template<> class numeric_limits<long>
665    {
666    public:
667        static const bool is_specialized = true;
668
669        // Bounding
670        static const bool is_bounded = true;
671        static long lowest() throw()
672            {return LONG_MIN;}
673        static long max( ) throw( )
674            {return LONG_MAX;}
675        static long min( ) throw( )
676            {return LONG_MIN;}
677
678        // infinity
679        static const bool has_infinity = false;
680        static long infinity( ) throw( )
681            {return 0;}
682
683        // Denormalization
684        static const float_denorm_style has_denorm = denorm_absent;
685        static const bool has_denorm_loss = false;
686        static long denorm_min( ) throw( )
687            {return 0;}
688
689        // Digits
690        static const bool is_signed = LONG_MIN != 0;
691        static const long digits = sizeof(long) * CHAR_BIT - (is_signed ? 1 : 0);
692        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
693        static const long digits10 = digits * 643 / 2136;
694
695        // NaN
696        static const bool has_quiet_NaN = false;
697        static const bool has_signaling_NaN = false;
698        static long quiet_NaN( ) throw( )
699            {return 0;}
700        static long signaling_NaN( ) throw( )
701            {return 0;}
702
703        // Information
704        static const bool is_exact = true;
705        static const bool is_iec559 = false;
706        static const bool is_longeger = true;
707        static const bool is_modulo = true;
708
709        // misc
710        static long epsilon( ) throw( )
711            {return 0;}
712        static const int max_digits10 = 0;
713        static const long radix = 2;
714        static const bool traps = false;
715
716        // exponent
717        static const long max_exponent = 0;
718        static const long max_exponent10 = 0;
719        static const long min_exponent = 0;
720        static const long min_exponent10 = 0;
721
722        // rounding
723        static long round_error( ) throw( )
724            {return 0;}
725        static const float_round_style round_style = round_toward_zero;
726        static const bool tinyness_before = false;
727    };
728
729    template<> class numeric_limits<unsigned long>
730    {
731    public:
732        static const bool is_specialized = true;
733
734        // Bounding
735        static const bool is_bounded = true;
736        static unsigned long lowest() throw()
737            {return 0;}
738        static unsigned long max( ) throw( )
739            {return ULONG_MAX;}
740        static unsigned long min( ) throw( )
741            {return 0;}
742
743        // infinity
744        static const bool has_infinity = false;
745        static unsigned long infinity( ) throw( )
746            {return 0;}
747
748        // Denormalization
749        static const float_denorm_style has_denorm = denorm_absent;
750        static const bool has_denorm_loss = false;
751        static unsigned long denorm_min( ) throw( )
752            {return 0;}
753
754        // Digits
755        static const long digits = sizeof(unsigned long) * CHAR_BIT;
756        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
757        static const long digits10 = digits * 643 / 2136;
758
759        // NaN
760        static const bool has_quiet_NaN = false;
761        static const bool has_signaling_NaN = false;
762        static unsigned long quiet_NaN( ) throw( )
763            {return 0;}
764        static unsigned long signaling_NaN( ) throw( )
765            {return 0;}
766
767        // Information
768        static const bool is_exact = true;
769        static const bool is_iec559 = false;
770        static const bool is_longeger = true;
771        static const bool is_modulo = true;
772        static const bool is_signed = false;
773
774        // misc
775        static unsigned long epsilon( ) throw( )
776            {return 0;}
777        static const int max_digits10 = 0;
778        static const long radix = 2;
779        static const bool traps = false;
780
781        // exponent
782        static const long max_exponent = 0;
783        static const long max_exponent10 = 0;
784        static const long min_exponent = 0;
785        static const long min_exponent10 = 0;
786
787        // rounding
788        static unsigned long round_error( ) throw( )
789            {return 0;}
790        static const float_round_style round_style = round_toward_zero;
791        static const bool tinyness_before = false;
792    };
793
794    template<> class numeric_limits<long long>
795    {
796    public:
797        static const bool is_specialized = true;
798
799        // Bounding
800        static const bool is_bounded = true;
801        static long long lowest() throw()
802            {return LLONG_MIN;}
803        static long long max( ) throw( )
804            {return LLONG_MAX;}
805        static long long min( ) throw( )
806            {return LLONG_MIN;}
807
808        // infinity
809        static const bool has_infinity = false;
810        static long long infinity( ) throw( )
811            {return 0;}
812
813        // Denormalization
814        static const float_denorm_style has_denorm = denorm_absent;
815        static const bool has_denorm_loss = false;
816        static long long denorm_min( ) throw( )
817            {return 0;}
818
819        // Digits
820        static const long long digits = sizeof(long long) * CHAR_BIT - (LLONG_MIN != 0 ? 1 : 0);
821        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
822        static const long long digits10 = digits * 643 / 2136;
823
824        // NaN
825        static const bool has_quiet_NaN = false;
826        static const bool has_signaling_NaN = false;
827        static long long quiet_NaN( ) throw( )
828            {return 0;}
829        static long long signaling_NaN( ) throw( )
830            {return 0;}
831
832        // Information
833        static const bool is_exact = true;
834        static const bool is_iec559 = false;
835        static const bool is_integer = true;
836        static const bool is_modulo = true;
837        static const bool is_signed = LLONG_MIN != 0;
838
839        // misc
840        static long long epsilon( ) throw( )
841            {return 0;}
842        static const int max_digits10 = 0;
843        static const long long radix = 2;
844        static const bool traps = false;
845
846        // exponent
847        static const long long max_exponent = 0;
848        static const long long max_exponent10 = 0;
849        static const long long min_exponent = 0;
850        static const long long min_exponent10 = 0;
851
852        // rounding
853        static long long round_error( ) throw( )
854            {return 0;}
855        static const float_round_style round_style = round_toward_zero;
856        static const bool tinyness_before = false;
857    };
858
859    template<> class numeric_limits<unsigned long long>
860    {
861    public:
862        static const bool is_specialized = true;
863
864        // Bounding
865        static const bool is_bounded = true;
866        static unsigned long long lowest() throw()
867            {return 0;}
868        static unsigned long long max( ) throw( )
869            {return ULLONG_MAX;}
870        static unsigned long long min( ) throw( )
871            {return 0;}
872
873        // infinity
874        static const bool has_infinity = false;
875        static unsigned long long infinity( ) throw( )
876            {return 0;}
877
878        // Denormalization
879        static const float_denorm_style has_denorm = denorm_absent;
880        static const bool has_denorm_loss = false;
881        static unsigned long long denorm_min( ) throw( )
882            {return 0;}
883
884        // Digits
885        static const long long digits = sizeof(unsigned long long) * CHAR_BIT;
886        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
887        static const long long digits10 = digits * 643 / 2136;
888
889        // NaN
890        static const bool has_quiet_NaN = false;
891        static const bool has_signaling_NaN = false;
892        static unsigned long long quiet_NaN( ) throw( )
893            {return 0;}
894        static unsigned long long signaling_NaN( ) throw( )
895            {return 0;}
896
897        // Information
898        static const bool is_exact = true;
899        static const bool is_iec559 = false;
900        static const bool is_integer = true;
901        static const bool is_modulo = true;
902        static const bool is_signed = false;
903
904        // misc
905        static unsigned long long epsilon( ) throw( )
906            {return 0;}
907        static const int max_digits10 = 0;
908        static const long long radix = 2;
909        static const bool traps = false;
910
911        // exponent
912        static const long long max_exponent = 0;
913        static const long long max_exponent10 = 0;
914        static const long long min_exponent = 0;
915        static const long long min_exponent10 = 0;
916
917        // rounding
918        static unsigned long long round_error( ) throw( )
919            {return 0;}
920        static const float_round_style round_style = round_toward_zero;
921        static const bool tinyness_before = false;
922    };
923
924    template<> class numeric_limits<float>
925    {
926    public:
927        static const bool is_specialized = true;
928
929        // Bounding
930        static const bool is_bounded = true;
931        static float lowest() throw()
932            {return -FLT_MAX;}
933        static float max( ) throw( )
934            {return FLT_MAX;}
935        static float min( ) throw( )
936            {return FLT_MIN;}
937
938        // infinity
939        static const bool has_infinity = true;
940        static float infinity( ) throw( )
941            //{return _FInf._Float;}
942        {
943            static const unsigned __inf_bytes = 0x7f800000;
944            return *(float*)&__inf_bytes;
945        }
946
947        // Denormalization
948        static const float_denorm_style has_denorm = denorm_present;
949        static const bool has_denorm_loss = true;
950        static float denorm_min( ) throw( )
951            {return _FDenorm._Float;}
952
953        // Digits
954        static const int digits = FLT_MANT_DIG;
955        static const int digits10 = FLT_DIG;
956
957        // NaN
958        static const bool has_quiet_NaN = true;
959        static const bool has_signaling_NaN = true;
960        static float quiet_NaN( ) throw( )
961            {return _FNan._Float;}
962        static float signaling_NaN( ) throw( )
963            {return _FSnan._Float;}
964
965        // Information
966        static const bool is_exact = false;
967        static const bool is_iec559 = true;
968        static const bool is_integer = false;
969        static const bool is_modulo = false;
970        static const bool is_signed = true;
971
972        // misc
973        static float epsilon( ) throw( )
974            {return FLT_EPSILON;}
975        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
976        static const int max_digits10 = FLT_MANT_DIG * 643 / 2136;
977        static const int radix = FLT_RADIX;
978        static const bool traps = true;
979
980        // exponent
981        static const int max_exponent = FLT_MAX_EXP;
982        static const int max_exponent10 = FLT_MAX_10_EXP;
983        static const int min_exponent = FLT_MIN_EXP;
984        static const int min_exponent10 = FLT_MIN_10_EXP;
985
986        // rounding
987        static float round_error( ) throw( )
988            {return 0.5f;}
989        static const float_round_style round_style = round_to_nearest;
990        static const bool tinyness_before = true;
991    };
992
993    template<> class numeric_limits<double>
994    {
995    public:
996        static const bool is_specialized = true;
997
998        // Bounding
999        static const bool is_bounded = true;
1000        static double lowest() throw()
1001            {return -DBL_MAX;}
1002        static double max( ) throw( )
1003            {return DBL_MAX;}
1004        static double min( ) throw( )
1005            {return DBL_MIN;}
1006
1007        // infinity
1008        static const bool has_infinity = true;
1009        static double infinity( ) throw( )
1010            {return _Inf._Double;}
1011
1012        // Denormalization
1013        static const float_denorm_style has_denorm = denorm_present;
1014        static const bool has_denorm_loss = true;
1015        static double denorm_min( ) throw( )
1016            {return _Denorm._Double;}
1017
1018        // Digits
1019        static const int digits = DBL_MANT_DIG;
1020        static const int digits10 = DBL_DIG;
1021
1022        // NaN
1023        static const bool has_quiet_NaN = true;
1024        static const bool has_signaling_NaN = true;
1025        static double quiet_NaN( ) throw( )
1026            {return _Nan._Double;}
1027        static double signaling_NaN( ) throw( )
1028            {return _Snan._Double;}
1029
1030        // Information
1031        static const bool is_exact = false;
1032        static const bool is_iec559 = true;
1033        static const bool is_integer = false;
1034        static const bool is_modulo = false;
1035        static const bool is_signed = true;
1036
1037        // misc
1038        static double epsilon( ) throw( )
1039            {return DBL_EPSILON;}
1040        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
1041        static const int max_digits10 = DBL_MANT_DIG * 643 / 2136;
1042        static const int radix = FLT_RADIX;
1043        static const bool traps = true;
1044
1045        // exponent
1046        static const int max_exponent = DBL_MAX_EXP;
1047        static const int max_exponent10 = DBL_MAX_10_EXP;
1048        static const int min_exponent = DBL_MIN_EXP;
1049        static const int min_exponent10 = DBL_MIN_10_EXP;
1050
1051        // rounding
1052        static double round_error( ) throw( )
1053            {return 0.5f;}
1054        static const float_round_style round_style = round_to_nearest;
1055        static const bool tinyness_before = true;
1056    };
1057
1058    template<> class numeric_limits<long double>
1059    {
1060    public:
1061        static const bool is_specialized = true;
1062
1063        // Bounding
1064        static const bool is_bounded = true;
1065        static long double lowest() throw()
1066            {return -LDBL_MAX;}
1067        static long double max( ) throw( )
1068            {return LDBL_MAX;}
1069        static long double min( ) throw( )
1070            {return DBL_MIN;}
1071
1072        // infinity
1073        static const bool has_infinity = true;
1074        static long double infinity( ) throw( )
1075            {return _LInf._Long_double;}
1076
1077        // Denormalization
1078        static const float_denorm_style has_denorm = denorm_present;
1079        static const bool has_denorm_loss = true;
1080        static long double denorm_min( ) throw( )
1081            {return _LDenorm._Long_double;}
1082
1083        // Digits
1084        static const int digits = LDBL_MANT_DIG;
1085        static const int digits10 = LDBL_DIG;
1086
1087        // NaN
1088        static const bool has_quiet_NaN = true;
1089        static const bool has_signaling_NaN = true;
1090        static long double quiet_NaN( ) throw( )
1091            {return _LNan._Long_double;}
1092        static long double signaling_NaN( ) throw( )
1093            {return _LSnan._Long_double;}
1094
1095        // Information
1096        static const bool is_exact = false;
1097        static const bool is_iec559 = true;
1098        static const bool is_integer = false;
1099        static const bool is_modulo = false;
1100        static const bool is_signed = true;
1101
1102        // misc
1103        static long double epsilon( ) throw( )
1104            {return LDBL_EPSILON;}
1105        // The fraction 643/2136 approximates log10(2) to 7 significant digits.
1106        static const int max_digits10 = FLT_MANT_DIG * 643 / 2136;
1107        static const int radix = FLT_RADIX;
1108        static const bool traps = true;
1109
1110        // exponent
1111        static const int max_exponent = LDBL_MAX_EXP;
1112        static const int max_exponent10 = LDBL_MAX_10_EXP;
1113        static const int min_exponent = LDBL_MIN_EXP;
1114        static const int min_exponent10 = LDBL_MIN_10_EXP;
1115
1116        // rounding
1117        static long double round_error( ) throw( )
1118            {return 0.5f;}
1119        static const float_round_style round_style = round_to_nearest;
1120        static const bool tinyness_before = true;
1121    };
1122}