mFrame
載入中...
搜尋中...
無符合項目
Float.h
1
8#ifndef MFRAME_55C55E8C_894B_425F_8421_0100EE370D17
9#define MFRAME_55C55E8C_894B_425F_8421_0100EE370D17
10
11/* ***************************************************************************************
12 * Float
13 */
14
15//----------------------------------------------------------------------------------------
16
17//----------------------------------------------------------------------------------------
18#include "./../numb/Number.h"
19
20/* ***************************************************************************************
21 * Namespace
22 */
23namespace ufm::numb {
24 class Float;
25} // namespace ufm::numb
26
27/* ***************************************************************************************
28 * Class Float
29 */
44class ufm::numb::Float final : public ufm::numb::Number {
45 /* *************************************************************************************
46 * Variable
47 */
48
49 /* *************************************************************************************
50 * Abstract Method
51 */
52
53 /* *************************************************************************************
54 * Construct Method
55 */
56 public:
62 Float(void);
63
70 Float(float value);
71
72 /* *************************************************************************************
73 * Operator Method
74 */
75 public:
81 inline operator float(void) {
82 return this->vValue.f32[0];
83 }
84
92 bool operator==(float v);
93
101
108 inline float operator=(float v) {
109 this->vValue.f32[0] = v;
110 return this->vValue.f32[0];
111 }
112
119 inline Float operator+=(float v) {
120 this->vValue.f32[0] += v;
121 return *this;
122 }
123
130 inline Float operator-=(float v) {
131 this->vValue.f32[0] -= v;
132 return *this;
133 }
134
141 inline Float operator*=(float v) {
142 this->vValue.f32[0] *= v;
143 return *this;
144 }
145
152 inline Float operator/=(float v) {
153 this->vValue.f32[0] /= v;
154 return *this;
155 }
156
162 inline Float operator++(int) {
163 Float tmp = *this;
164 ++this->vValue.f32[0];
165 return tmp;
166 }
167
173 inline Float operator++() {
174 ++this->vValue.f32[0];
175 return *this;
176 }
177
183 inline Float operator--(int) {
184 Float tmp = *this;
185 --this->vValue.f32[0];
186 return tmp;
187 }
188
194 inline Float& operator--(void) {
195 --this->vValue.f32[0];
196 return *this;
197 }
198 /* *************************************************************************************
199 * Override Method
200 */
201
202 /* *************************************************************************************
203 * Public Method
204 */
205
206 /* *************************************************************************************
207 * Protected Method
208 */
209
210 /* *************************************************************************************
211 * Private Method
212 */
213
214 /* *************************************************************************************
215 * Static Variable
216 */
217 public:
218 static const int SIZE;
219 static const float EQUAL_EPSILIN;
220
221 /* *************************************************************************************
222 * Static Method
223 */
224};
225
226/* ***************************************************************************************
227 * End of file
228 */
229
230#endif /* MFRAME_55C55E8C_894B_425F_8421_0100EE370D17 */
浮點數封裝類
Definition Float.h:44
static const int SIZE
浮點數大小(位元組)
Definition Float.h:218
Float operator++()
前置遞增運算子
Definition Float.h:173
Float(float value)
建構 Float 物件
Float operator+=(float v)
加法指定運算子
Definition Float.h:119
Float(void)
建構 Float 物件
Float operator++(int)
後置遞增運算子
Definition Float.h:162
Float operator/=(float v)
除法指定運算子
Definition Float.h:152
float operator=(float v)
指定運算子
Definition Float.h:108
Float operator--(int)
後置遞減運算子
Definition Float.h:183
Float operator*=(float v)
乘法指定運算子
Definition Float.h:141
Float & operator--(void)
前置遞減運算子
Definition Float.h:194
static const float EQUAL_EPSILIN
浮點數比較精度
Definition Float.h:219
bool operator==(float v)
比較Float物件與浮點數是否相等
bool operator==(Float &v)
比較兩個Float物件是否相等
Float operator-=(float v)
減法指定運算子
Definition Float.h:130
[Interface] 數值基礎抽象類
Definition Number.h:44
Value vValue
數值儲存體
Definition Number.h:72
Definition Boolean.h:23
float f32[2]
32位元浮點數陣列
Definition Number.h:62