FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
num_traits.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** FougTools
3 ** Copyright Fougue (30 Mar. 2015)
4 ** contact@fougue.pro
5 **
6 ** This software is a computer program whose purpose is to provide utility
7 ** tools for the C++ language and the Qt toolkit.
8 **
9 ** This software is governed by the CeCILL-C license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-C
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info".
14 ****************************************************************************/
15 
16 #ifndef MATHTOOLS_NUM_TRAITS_H
17 #define MATHTOOLS_NUM_TRAITS_H
18 
19 namespace math {
20 
25 template<typename T>
27 {
28  typedef T Real;
29 
30  static Real precision() { return Real(0); }
31 };
32 
33 template<typename T>
34 struct NumTraits : public BaseNumTraits<T>
35 { };
36 
41 template<> struct NumTraits<float> : public BaseNumTraits<float>
42 {
43  static Real precision() { return 1e-5f; }
44 };
45 
50 template<> struct NumTraits<double> : public BaseNumTraits<double>
51 {
52  static Real precision() { return 1e-12; }
53 };
54 
59 template<> struct NumTraits<long double> : public BaseNumTraits<long double>
60 {
61  static Real precision() { return 1e-15l; }
62 };
63 
64 } // namespace math
65 
66 #endif // MATHTOOLS_NUM_TRAITS_H
static Real precision()
Definition: num_traits.h:52
static Real precision()
Definition: num_traits.h:30
static Real precision()
Definition: num_traits.h:43
Definition: consts.h:18
Type traits on real numerical types (float, double, ...)
Definition: num_traits.h:26
Definition: num_traits.h:34
T Real
Definition: num_traits.h:28
static Real precision()
Definition: num_traits.h:61