Debian Codegraph @

headers/limits

raw
1 /* Copyright (C) 2015 Povilas Kanapickas <[email protected]>
2
3 This file is part of cppreference-doc
4
5 This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
6 Unported License. To view a copy of this license, visit
7 http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
8 Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
9
10 Permission is granted to copy, distribute and/or modify this document
11 under the terms of the GNU Free Documentation License, Version 1.3 or
12 any later version published by the Free Software Foundation; with no
13 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
14 */
15
16 #ifndef CPPREFERENCE_LIMITS_H
17 #define CPPREFERENCE_LIMITS_H
18
19 namespace std {
20
21 enum float_round_style {
22 round_indeterminate = -1,
23 round_toward_zero = 0,
24 round_to_nearest = 1,
25 round_toward_infinity = 2,
26 round_toward_neg_infinity = 3
27 };
28
29 enum float_denorm_style {
30 denorm_indeterminate = -1,
31 denorm_absent = 0,
32 denorm_present = 1
33 };
34
35 template<class T>
36 class numeric_limits {
37 public:
38 #if CPPREFERENCE_STDVER <2011
39 static const bool is_specialized;
40 static const bool is_signed;
41 static const bool is_integer;
42 static const bool is_exact;
43 static const bool has_infinity;
44 static const bool has_quiet_NaN;
45 static const bool has_signaling_NaN;
46 static const float_denorm_style has_denorm;
47 static const bool has_denorm_loss;
48 static const float_round_style round_style;
49 static const bool is_iec559;
50 static const bool is_bounded;
51 static const bool is_modulo;
52 static const int digits;
53 static const int digits10;
54 static const int radix;
55 static const int min_exponent;
56 static const int min_exponent10;
57 static const int max_exponent;
58 static const int max_exponent10;
59 static const bool traps;
60 static const bool tinyness_before;
61
62 static T min();
63 static T lowest();
64 static T max();
65 static T epsilon();
66 static T round_error();
67 static T infinity();
68 static T quiet_NaN();
69 static T signaling_NaN();
70 static T denorm_min();
71 #else
72 static constexpr bool is_specialized;
73 static constexpr bool is_signed;
74 static constexpr bool is_integer;
75 static constexpr bool is_exact;
76 static constexpr bool has_infinity;
77 static constexpr bool has_quiet_NaN;
78 static constexpr bool has_signaling_NaN;
79 static constexpr float_denorm_style has_denorm;
80 static constexpr bool has_denorm_loss;
81 static constexpr float_round_style round_style;
82 static constexpr bool is_iec559;
83 static constexpr bool is_bounded;
84 static constexpr bool is_modulo;
85 static constexpr int digits;
86 static constexpr int digits10;
87 static constexpr int max_digits10; // new in C++11
88 static constexpr int radix;
89 static constexpr int min_exponent;
90 static constexpr int min_exponent10;
91 static constexpr int max_exponent;
92 static constexpr int max_exponent10;
93 static constexpr bool traps;
94 static constexpr bool tinyness_before;
95
96 static constexpr T min();
97 static constexpr T lowest();
98 static constexpr T max();
99 static constexpr T epsilon();
100 static constexpr T round_error();
101 static constexpr T infinity();
102 static constexpr T quiet_NaN();
103 static constexpr T signaling_NaN();
104 static constexpr T denorm_min();
105 #endif
106 };
107
108 } // namespace std
109
110 #endif // CPPREFERENCE_LIMITS_H