00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef MLN_VALUE_BUILTIN_FLOATINGS_HH
00027 # define MLN_VALUE_BUILTIN_FLOATINGS_HH
00028 
00032 
00033 # include <mln/value/internal/limits.hh>
00034 
00035 # include <mln/value/concept/built_in.hh>
00036 # include <mln/value/concept/floating.hh>
00037 # include <mln/trait/value_.hh>
00038 
00039 
00040 namespace mln
00041 {
00042 
00043 
00044   template <>
00045   struct category< float >
00046   {
00047     typedef value::Built_In< value::Floating<void> > ret;
00048   };
00049 
00050   template <>
00051   struct category< double >
00052   {
00053     typedef value::Built_In< value::Floating<void> > ret;
00054   };
00055 
00056 
00057   namespace trait
00058   {
00059 
00060 
00061     
00062 
00063     template <>
00064     struct value_< float >
00065     {
00066       enum {
00067         dim   = 1,
00068         nbits = 8 * sizeof(float),
00069         card  = 0
00070       };
00071 
00072       typedef value::nature::floating nature;
00073       typedef value::kind::data       kind;
00074       typedef value::quant::high      quant;
00075 
00076       static float min()
00077       {
00078         static const float min_ = mln::value::internal::limits<float>::min();
00079         return min_;
00080       }
00081       static float max()
00082       {
00083         static const float max_ = mln::value::internal::limits<float>::max();
00084         return max_;
00085       }
00086       static float epsilon()
00087       {
00088         static const float epsilon_ = mln::value::internal::limits<float>::epsilon();
00089         return epsilon_;
00090       }
00091 
00092       typedef float                        sum;
00093 
00094       static const char* name()
00095       { return "float"; }
00096 
00097     };
00098 
00099 
00100     
00101 
00102     template <>
00103     struct value_< double >
00104     {
00105       enum {
00106         dim   = 1,
00107         nbits = 8 * sizeof(double),
00108         card  = 0
00109       };
00110 
00111       typedef value::nature::floating nature;
00112       typedef value::kind::data       kind;
00113       typedef value::quant::high      quant;
00114 
00115       static double min()
00116       {
00117         static const double min_ = mln::value::internal::limits<double>::min();
00118         return min_;
00119       }
00120       static double max()
00121       {
00122         static const double max_ = mln::value::internal::limits<double>::max();
00123         return max_;
00124       }
00125       static double epsilon()
00126       {
00127         static const double epsilon_ = mln::value::internal::limits<double>::epsilon();
00128         return epsilon_;
00129       }
00130 
00131       typedef double                        sum;
00132 
00133       static const char* name()
00134       { return "float"; }
00135 
00136     };
00137 
00138   } 
00139 
00140 } 
00141 
00142 
00143 #endif // ! MLN_VALUE_BUILTIN_FLOATINGS_HH