lemon/tolerance.h
changeset 36 d6bc33fa6590
parent 7 4d461e9867da
child 39 0a01d811071f
equal deleted inserted replaced
0:be687958f998 1:5b076a5d05b0
    46   ///
    46   ///
    47   ///\sa Tolerance<float>
    47   ///\sa Tolerance<float>
    48   ///\sa Tolerance<double>
    48   ///\sa Tolerance<double>
    49   ///\sa Tolerance<long double>
    49   ///\sa Tolerance<long double>
    50   ///\sa Tolerance<int>
    50   ///\sa Tolerance<int>
       
    51 #if defined __GNUC__ && !defined __STRICT_ANSI__  
    51   ///\sa Tolerance<long long int>
    52   ///\sa Tolerance<long long int>
       
    53 #endif
    52   ///\sa Tolerance<unsigned int>
    54   ///\sa Tolerance<unsigned int>
       
    55 #if defined __GNUC__ && !defined __STRICT_ANSI__  
    53   ///\sa Tolerance<unsigned long long int>
    56   ///\sa Tolerance<unsigned long long int>
       
    57 #endif
    54 
    58 
    55   template<class T>
    59   template<class T>
    56   class Tolerance
    60   class Tolerance
    57   {
    61   {
    58   public:
    62   public:
   128     ///Returns \c true if \c a is \e surely positive
   132     ///Returns \c true if \c a is \e surely positive
   129     bool positive(Value a) const { return _epsilon<a; }
   133     bool positive(Value a) const { return _epsilon<a; }
   130     ///Returns \c true if \c a is \e surely negative
   134     ///Returns \c true if \c a is \e surely negative
   131     bool negative(Value a) const { return -_epsilon>a; }
   135     bool negative(Value a) const { return -_epsilon>a; }
   132     ///Returns \c true if \c a is \e surely non-zero
   136     ///Returns \c true if \c a is \e surely non-zero
   133     bool nonZero(Value a) const { return positive(a)||negative(a); };
   137     bool nonZero(Value a) const { return positive(a)||negative(a); }
   134 
   138 
   135     ///@}
   139     ///@}
   136 
   140 
   137     ///Returns zero
   141     ///Returns zero
   138     static Value zero() {return 0;}
   142     static Value zero() {return 0;}
   179     ///Returns \c true if \c a is \e surely positive
   183     ///Returns \c true if \c a is \e surely positive
   180     bool positive(Value a) const { return _epsilon<a; }
   184     bool positive(Value a) const { return _epsilon<a; }
   181     ///Returns \c true if \c a is \e surely negative
   185     ///Returns \c true if \c a is \e surely negative
   182     bool negative(Value a) const { return -_epsilon>a; }
   186     bool negative(Value a) const { return -_epsilon>a; }
   183     ///Returns \c true if \c a is \e surely non-zero
   187     ///Returns \c true if \c a is \e surely non-zero
   184     bool nonZero(Value a) const { return positive(a)||negative(a); };
   188     bool nonZero(Value a) const { return positive(a)||negative(a); }
   185 
   189 
   186     ///@}
   190     ///@}
   187 
   191 
   188     ///Returns zero
   192     ///Returns zero
   189     static Value zero() {return 0;}
   193     static Value zero() {return 0;}
   230     ///Returns \c true if \c a is \e surely positive
   234     ///Returns \c true if \c a is \e surely positive
   231     bool positive(Value a) const { return _epsilon<a; }
   235     bool positive(Value a) const { return _epsilon<a; }
   232     ///Returns \c true if \c a is \e surely negative
   236     ///Returns \c true if \c a is \e surely negative
   233     bool negative(Value a) const { return -_epsilon>a; }
   237     bool negative(Value a) const { return -_epsilon>a; }
   234     ///Returns \c true if \c a is \e surely non-zero
   238     ///Returns \c true if \c a is \e surely non-zero
   235     bool nonZero(Value a) const { return positive(a)||negative(a); };
   239     bool nonZero(Value a) const { return positive(a)||negative(a); }
   236 
   240 
   237     ///@}
   241     ///@}
   238 
   242 
   239     ///Returns zero
   243     ///Returns zero
   240     static Value zero() {return 0;}
   244     static Value zero() {return 0;}
   263     ///Returns \c true if \c a is \e surely positive
   267     ///Returns \c true if \c a is \e surely positive
   264     static bool positive(Value a) { return 0<a; }
   268     static bool positive(Value a) { return 0<a; }
   265     ///Returns \c true if \c a is \e surely negative
   269     ///Returns \c true if \c a is \e surely negative
   266     static bool negative(Value a) { return 0>a; }
   270     static bool negative(Value a) { return 0>a; }
   267     ///Returns \c true if \c a is \e surely non-zero
   271     ///Returns \c true if \c a is \e surely non-zero
   268     static bool nonZero(Value a) { return a!=0; };
   272     static bool nonZero(Value a) { return a!=0; }
   269 
   273 
   270     ///@}
   274     ///@}
   271 
   275 
   272     ///Returns zero
   276     ///Returns zero
   273     static Value zero() {return 0;}
   277     static Value zero() {return 0;}
   296     ///Returns \c true if \c a is \e surely positive
   300     ///Returns \c true if \c a is \e surely positive
   297     static bool positive(Value a) { return 0<a; }
   301     static bool positive(Value a) { return 0<a; }
   298     ///Returns \c true if \c a is \e surely negative
   302     ///Returns \c true if \c a is \e surely negative
   299     static bool negative(Value) { return false; }
   303     static bool negative(Value) { return false; }
   300     ///Returns \c true if \c a is \e surely non-zero
   304     ///Returns \c true if \c a is \e surely non-zero
   301     static bool nonZero(Value a) { return a!=0; };
   305     static bool nonZero(Value a) { return a!=0; }
   302 
   306 
   303     ///@}
   307     ///@}
   304 
   308 
   305     ///Returns zero
   309     ///Returns zero
   306     static Value zero() {return 0;}
   310     static Value zero() {return 0;}
   330     ///Returns \c true if \c a is \e surely positive
   334     ///Returns \c true if \c a is \e surely positive
   331     static bool positive(Value a) { return 0<a; }
   335     static bool positive(Value a) { return 0<a; }
   332     ///Returns \c true if \c a is \e surely negative
   336     ///Returns \c true if \c a is \e surely negative
   333     static bool negative(Value a) { return 0>a; }
   337     static bool negative(Value a) { return 0>a; }
   334     ///Returns \c true if \c a is \e surely non-zero
   338     ///Returns \c true if \c a is \e surely non-zero
   335     static bool nonZero(Value a) { return a!=0;};
   339     static bool nonZero(Value a) { return a!=0;}
   336 
   340 
   337     ///@}
   341     ///@}
   338 
   342 
   339     ///Returns zero
   343     ///Returns zero
   340     static Value zero() {return 0;}
   344     static Value zero() {return 0;}
   363     ///Returns \c true if \c a is \e surely positive
   367     ///Returns \c true if \c a is \e surely positive
   364     static bool positive(Value a) { return 0<a; }
   368     static bool positive(Value a) { return 0<a; }
   365     ///Returns \c true if \c a is \e surely negative
   369     ///Returns \c true if \c a is \e surely negative
   366     static bool negative(Value) { return false; }
   370     static bool negative(Value) { return false; }
   367     ///Returns \c true if \c a is \e surely non-zero
   371     ///Returns \c true if \c a is \e surely non-zero
   368     static bool nonZero(Value a) { return a!=0;};
   372     static bool nonZero(Value a) { return a!=0;}
   369 
   373 
   370     ///@}
   374     ///@}
   371 
   375 
   372     ///Returns zero
   376     ///Returns zero
   373     static Value zero() {return 0;}
   377     static Value zero() {return 0;}
   400     ///Returns \c true if \c a is \e surely positive
   404     ///Returns \c true if \c a is \e surely positive
   401     static bool positive(Value a) { return 0<a; }
   405     static bool positive(Value a) { return 0<a; }
   402     ///Returns \c true if \c a is \e surely negative
   406     ///Returns \c true if \c a is \e surely negative
   403     static bool negative(Value a) { return 0>a; }
   407     static bool negative(Value a) { return 0>a; }
   404     ///Returns \c true if \c a is \e surely non-zero
   408     ///Returns \c true if \c a is \e surely non-zero
   405     static bool nonZero(Value a) { return a!=0;};
   409     static bool nonZero(Value a) { return a!=0;}
   406 
   410 
   407     ///@}
   411     ///@}
   408 
   412 
   409     ///Returns zero
   413     ///Returns zero
   410     static Value zero() {return 0;}
   414     static Value zero() {return 0;}
   435     ///Returns \c true if \c a is \e surely positive
   439     ///Returns \c true if \c a is \e surely positive
   436     static bool positive(Value a) { return 0<a; }
   440     static bool positive(Value a) { return 0<a; }
   437     ///Returns \c true if \c a is \e surely negative
   441     ///Returns \c true if \c a is \e surely negative
   438     static bool negative(Value) { return false; }
   442     static bool negative(Value) { return false; }
   439     ///Returns \c true if \c a is \e surely non-zero
   443     ///Returns \c true if \c a is \e surely non-zero
   440     static bool nonZero(Value a) { return a!=0;};
   444     static bool nonZero(Value a) { return a!=0;}
   441 
   445 
   442     ///@}
   446     ///@}
   443 
   447 
   444     ///Returns zero
   448     ///Returns zero
   445     static Value zero() {return 0;}
   449     static Value zero() {return 0;}