FixedLimits.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Louis Langholtz https://github.com/louis-langholtz/PlayRho
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty. In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  * claim that you wrote the original software. If you use this software
14  * in a product, an acknowledgment in the product documentation would be
15  * appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  * misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  */
20 
21 #ifndef PLAYRHO_COMMON_FIXEDLIMITS_HPP
22 #define PLAYRHO_COMMON_FIXEDLIMITS_HPP
23 
24 #include <PlayRho/Common/Fixed.hpp>
25 
26 namespace std {
27 
30  template <typename BT, unsigned int FB>
31  class numeric_limits<playrho::Fixed<BT,FB>>
32  {
33  public:
34  static PLAYRHO_CONSTEXPR const bool is_specialized = true;
35 
38 
41 
44 
46  static PLAYRHO_CONSTEXPR const int digits = playrho::Fixed<BT,FB>::WholeBits - 1;
47 
49  static PLAYRHO_CONSTEXPR const int digits10 = playrho::Fixed<BT,FB>::WholeBits - 1;
50 
52  static PLAYRHO_CONSTEXPR const int max_digits10 = 5; // TODO(lou): check this
53 
54  static PLAYRHO_CONSTEXPR const bool is_signed = true;
55  static PLAYRHO_CONSTEXPR const bool is_integer = false;
56  static PLAYRHO_CONSTEXPR const bool is_exact = true;
57  static PLAYRHO_CONSTEXPR const int radix = 0;
58 
60  static PLAYRHO_CONSTEXPR inline playrho::Fixed32 epsilon() noexcept { return playrho::Fixed<BT,FB>{0}; } // TODO(lou)
61 
63  static PLAYRHO_CONSTEXPR inline playrho::Fixed32 round_error() noexcept { return playrho::Fixed<BT,FB>{0}; } // TODO(lou)
64 
67  static PLAYRHO_CONSTEXPR const int min_exponent = 0;
68 
70  static PLAYRHO_CONSTEXPR const int min_exponent10 = 0;
71 
74  static PLAYRHO_CONSTEXPR const int max_exponent = 0;
75 
77  static PLAYRHO_CONSTEXPR const int max_exponent10 = 0;
78 
79  static PLAYRHO_CONSTEXPR const bool has_infinity = true;
80  static PLAYRHO_CONSTEXPR const bool has_quiet_NaN = true;
81  static PLAYRHO_CONSTEXPR const bool has_signaling_NaN = false;
82  static PLAYRHO_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
83  static PLAYRHO_CONSTEXPR const bool has_denorm_loss = false;
84 
87 
90 
93 
96 
97  static PLAYRHO_CONSTEXPR const bool is_iec559 = false;
98  static PLAYRHO_CONSTEXPR const bool is_bounded = true;
99  static PLAYRHO_CONSTEXPR const bool is_modulo = false;
100 
101  static PLAYRHO_CONSTEXPR const bool traps = false;
102  static PLAYRHO_CONSTEXPR const bool tinyness_before = false;
103  static PLAYRHO_CONSTEXPR const float_round_style round_style = round_toward_zero;
104  };
105 
106 } // namespace std
107 
108 #endif // PLAYRHO_COMMON_FIXEDLIMITS_HPP