... |
... |
@@ -36,17 +36,17 @@
|
36 |
36 |
///handle the comparison of numbers that are obtained
|
37 |
37 |
///as a result of a probably inexact computation.
|
38 |
38 |
///
|
39 |
39 |
///Tolerance is a class to provide a basic way to
|
40 |
40 |
///handle the comparison of numbers that are obtained
|
41 |
41 |
///as a result of a probably inexact computation.
|
42 |
42 |
///
|
43 |
43 |
///This is an abstract class, it should be specialized for all numerical
|
44 |
|
///data types. These specialized classes like \ref Tolerance\<double\>
|
|
44 |
///data types. These specialized classes like Tolerance<double>
|
45 |
45 |
///may offer additional tuning parameters.
|
46 |
46 |
///
|
47 |
47 |
///\sa Tolerance<float>
|
48 |
48 |
///\sa Tolerance<double>
|
49 |
49 |
///\sa Tolerance<long double>
|
50 |
50 |
///\sa Tolerance<int>
|
51 |
51 |
#if defined __GNUC__ && !defined __STRICT_ANSI__
|
52 |
52 |
///\sa Tolerance<long long int>
|
... |
... |
@@ -86,19 +86,19 @@
|
86 |
86 |
static Value zero() {return T();}
|
87 |
87 |
|
88 |
88 |
// static bool finite(Value a) {}
|
89 |
89 |
// static Value big() {}
|
90 |
90 |
// static Value negativeBig() {}
|
91 |
91 |
};
|
92 |
92 |
|
93 |
93 |
|
94 |
|
///Float specialization of \ref Tolerance.
|
|
94 |
///Float specialization of Tolerance.
|
95 |
95 |
|
96 |
|
///Float specialization of \ref Tolerance.
|
|
96 |
///Float specialization of Tolerance.
|
97 |
97 |
///\sa Tolerance
|
98 |
98 |
///\relates Tolerance
|
99 |
99 |
template<>
|
100 |
100 |
class Tolerance<float>
|
101 |
101 |
{
|
102 |
102 |
static float def_epsilon;
|
103 |
103 |
float _epsilon;
|
104 |
104 |
public:
|
... |
... |
@@ -137,19 +137,19 @@
|
137 |
137 |
bool nonZero(Value a) const { return positive(a)||negative(a); }
|
138 |
138 |
|
139 |
139 |
///@}
|
140 |
140 |
|
141 |
141 |
///Returns zero
|
142 |
142 |
static Value zero() {return 0;}
|
143 |
143 |
};
|
144 |
144 |
|
145 |
|
///Double specialization of \ref Tolerance.
|
|
145 |
///Double specialization of Tolerance.
|
146 |
146 |
|
147 |
|
///Double specialization of \ref Tolerance.
|
|
147 |
///Double specialization of Tolerance.
|
148 |
148 |
///\sa Tolerance
|
149 |
149 |
///\relates Tolerance
|
150 |
150 |
template<>
|
151 |
151 |
class Tolerance<double>
|
152 |
152 |
{
|
153 |
153 |
static double def_epsilon;
|
154 |
154 |
double _epsilon;
|
155 |
155 |
public:
|
... |
... |
@@ -188,19 +188,19 @@
|
188 |
188 |
bool nonZero(Value a) const { return positive(a)||negative(a); }
|
189 |
189 |
|
190 |
190 |
///@}
|
191 |
191 |
|
192 |
192 |
///Returns zero
|
193 |
193 |
static Value zero() {return 0;}
|
194 |
194 |
};
|
195 |
195 |
|
196 |
|
///Long double specialization of \ref Tolerance.
|
|
196 |
///Long double specialization of Tolerance.
|
197 |
197 |
|
198 |
|
///Long double specialization of \ref Tolerance.
|
|
198 |
///Long double specialization of Tolerance.
|
199 |
199 |
///\sa Tolerance
|
200 |
200 |
///\relates Tolerance
|
201 |
201 |
template<>
|
202 |
202 |
class Tolerance<long double>
|
203 |
203 |
{
|
204 |
204 |
static long double def_epsilon;
|
205 |
205 |
long double _epsilon;
|
206 |
206 |
public:
|
... |
... |
@@ -239,29 +239,29 @@
|
239 |
239 |
bool nonZero(Value a) const { return positive(a)||negative(a); }
|
240 |
240 |
|
241 |
241 |
///@}
|
242 |
242 |
|
243 |
243 |
///Returns zero
|
244 |
244 |
static Value zero() {return 0;}
|
245 |
245 |
};
|
246 |
246 |
|
247 |
|
///Integer specialization of \ref Tolerance.
|
|
247 |
///Integer specialization of Tolerance.
|
248 |
248 |
|
249 |
|
///Integer specialization of \ref Tolerance.
|
|
249 |
///Integer specialization of Tolerance.
|
250 |
250 |
///\sa Tolerance
|
251 |
251 |
template<>
|
252 |
252 |
class Tolerance<int>
|
253 |
253 |
{
|
254 |
254 |
public:
|
255 |
255 |
///\e
|
256 |
256 |
typedef int Value;
|
257 |
257 |
|
258 |
258 |
///\name Comparisons
|
259 |
|
///See \ref Tolerance for more details.
|
|
259 |
///See Tolerance for more details.
|
260 |
260 |
|
261 |
261 |
///@{
|
262 |
262 |
|
263 |
263 |
///Returns \c true if \c a is \e surely strictly less than \c b
|
264 |
264 |
static bool less(Value a,Value b) { return a<b;}
|
265 |
265 |
///Returns \c true if \c a is \e surely different from \c b
|
266 |
266 |
static bool different(Value a,Value b) { return a!=b; }
|
267 |
267 |
///Returns \c true if \c a is \e surely positive
|
... |
... |
@@ -272,29 +272,29 @@
|
272 |
272 |
static bool nonZero(Value a) { return a!=0; }
|
273 |
273 |
|
274 |
274 |
///@}
|
275 |
275 |
|
276 |
276 |
///Returns zero
|
277 |
277 |
static Value zero() {return 0;}
|
278 |
278 |
};
|
279 |
279 |
|
280 |
|
///Unsigned integer specialization of \ref Tolerance.
|
|
280 |
///Unsigned integer specialization of Tolerance.
|
281 |
281 |
|
282 |
282 |
///Unsigned integer specialization of \ref Tolerance.
|
283 |
283 |
///\sa Tolerance
|
284 |
284 |
template<>
|
285 |
285 |
class Tolerance<unsigned int>
|
286 |
286 |
{
|
287 |
287 |
public:
|
288 |
288 |
///\e
|
289 |
289 |
typedef unsigned int Value;
|
290 |
290 |
|
291 |
291 |
///\name Comparisons
|
292 |
|
///See \ref Tolerance for more details.
|
|
292 |
///See Tolerance for more details.
|
293 |
293 |
|
294 |
294 |
///@{
|
295 |
295 |
|
296 |
296 |
///Returns \c true if \c a is \e surely strictly less than \c b
|
297 |
297 |
static bool less(Value a,Value b) { return a<b;}
|
298 |
298 |
///Returns \c true if \c a is \e surely different from \c b
|
299 |
299 |
static bool different(Value a,Value b) { return a!=b; }
|
300 |
300 |
///Returns \c true if \c a is \e surely positive
|
... |
... |
@@ -306,29 +306,29 @@
|
306 |
306 |
|
307 |
307 |
///@}
|
308 |
308 |
|
309 |
309 |
///Returns zero
|
310 |
310 |
static Value zero() {return 0;}
|
311 |
311 |
};
|
312 |
312 |
|
313 |
313 |
|
314 |
|
///Long integer specialization of \ref Tolerance.
|
|
314 |
///Long integer specialization of Tolerance.
|
315 |
315 |
|
316 |
|
///Long integer specialization of \ref Tolerance.
|
|
316 |
///Long integer specialization of Tolerance.
|
317 |
317 |
///\sa Tolerance
|
318 |
318 |
template<>
|
319 |
319 |
class Tolerance<long int>
|
320 |
320 |
{
|
321 |
321 |
public:
|
322 |
322 |
///\e
|
323 |
323 |
typedef long int Value;
|
324 |
324 |
|
325 |
325 |
///\name Comparisons
|
326 |
|
///See \ref Tolerance for more details.
|
|
326 |
///See Tolerance for more details.
|
327 |
327 |
|
328 |
328 |
///@{
|
329 |
329 |
|
330 |
330 |
///Returns \c true if \c a is \e surely strictly less than \c b
|
331 |
331 |
static bool less(Value a,Value b) { return a<b;}
|
332 |
332 |
///Returns \c true if \c a is \e surely different from \c b
|
333 |
333 |
static bool different(Value a,Value b) { return a!=b; }
|
334 |
334 |
///Returns \c true if \c a is \e surely positive
|
... |
... |
@@ -339,29 +339,29 @@
|
339 |
339 |
static bool nonZero(Value a) { return a!=0;}
|
340 |
340 |
|
341 |
341 |
///@}
|
342 |
342 |
|
343 |
343 |
///Returns zero
|
344 |
344 |
static Value zero() {return 0;}
|
345 |
345 |
};
|
346 |
346 |
|
347 |
|
///Unsigned long integer specialization of \ref Tolerance.
|
|
347 |
///Unsigned long integer specialization of Tolerance.
|
348 |
348 |
|
349 |
349 |
///Unsigned long integer specialization of \ref Tolerance.
|
350 |
350 |
///\sa Tolerance
|
351 |
351 |
template<>
|
352 |
352 |
class Tolerance<unsigned long int>
|
353 |
353 |
{
|
354 |
354 |
public:
|
355 |
355 |
///\e
|
356 |
356 |
typedef unsigned long int Value;
|
357 |
357 |
|
358 |
358 |
///\name Comparisons
|
359 |
|
///See \ref Tolerance for more details.
|
|
359 |
///See Tolerance for more details.
|
360 |
360 |
|
361 |
361 |
///@{
|
362 |
362 |
|
363 |
363 |
///Returns \c true if \c a is \e surely strictly less than \c b
|
364 |
364 |
static bool less(Value a,Value b) { return a<b;}
|
365 |
365 |
///Returns \c true if \c a is \e surely different from \c b
|
366 |
366 |
static bool different(Value a,Value b) { return a!=b; }
|
367 |
367 |
///Returns \c true if \c a is \e surely positive
|
... |
... |
@@ -374,17 +374,17 @@
|
374 |
374 |
///@}
|
375 |
375 |
|
376 |
376 |
///Returns zero
|
377 |
377 |
static Value zero() {return 0;}
|
378 |
378 |
};
|
379 |
379 |
|
380 |
380 |
#if defined __GNUC__ && !defined __STRICT_ANSI__
|
381 |
381 |
|
382 |
|
///Long long integer specialization of \ref Tolerance.
|
|
382 |
///Long long integer specialization of Tolerance.
|
383 |
383 |
|
384 |
384 |
///Long long integer specialization of \ref Tolerance.
|
385 |
385 |
///\warning This class (more exactly, type <tt>long long</tt>)
|
386 |
386 |
///is not ansi compatible.
|
387 |
387 |
///\sa Tolerance
|
388 |
388 |
template<>
|
389 |
389 |
class Tolerance<long long int>
|
390 |
390 |
{
|
... |
... |
@@ -409,17 +409,17 @@
|
409 |
409 |
static bool nonZero(Value a) { return a!=0;}
|
410 |
410 |
|
411 |
411 |
///@}
|
412 |
412 |
|
413 |
413 |
///Returns zero
|
414 |
414 |
static Value zero() {return 0;}
|
415 |
415 |
};
|
416 |
416 |
|
417 |
|
///Unsigned long long integer specialization of \ref Tolerance.
|
|
417 |
///Unsigned long long integer specialization of Tolerance.
|
418 |
418 |
|
419 |
419 |
///Unsigned long long integer specialization of \ref Tolerance.
|
420 |
420 |
///\warning This class (more exactly, type <tt>unsigned long long</tt>)
|
421 |
421 |
///is not ansi compatible.
|
422 |
422 |
///\sa Tolerance
|
423 |
423 |
template<>
|
424 |
424 |
class Tolerance<unsigned long long int>
|
425 |
425 |
{
|