00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __BFL_CONSTANTS_H__
00019 #define __BFL_CONSTANTS_H__
00020
00021 #define NUMERIC_PRECISION 0.000000001
00022
00023 #pragma warning( disable : 4996)
00024
00025 #ifndef M_PI
00026 #define M_PI 3.141592653589793284626433832795
00027 #endif
00028
00029
00030
00031 #include <iostream>
00032 #include <cmath>
00033 #include <cassert>
00034
00035 namespace BFL
00036 {
00038 class Probability
00039 {
00040 public:
00041 Probability(){};
00042 Probability(double p)
00043 {
00044 #ifndef _MSC_VER
00045 assert(std::isfinite(p) != 0);
00046 #endif
00047 assert( p >= 0 );
00048 _prob = p;
00049 }
00050 virtual ~Probability(){};
00051
00052 operator double(){return _prob;}
00053 Probability operator *(Probability p)
00054 { return ((Probability) (this->_prob * (double) p));}
00055 Probability operator /(Probability p)
00056 { return ((Probability) (this->_prob / (double) p));}
00057 private:
00058 double _prob;
00059 };
00060 }
00061
00076 #endif