rel-test.hpp
Go to the documentation of this file.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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 namespace Gecode { namespace Float {
00041
00042 template<class View>
00043 forceinline RelTest
00044 rtest_eq(View x, View y) {
00045 if ((x.min() > y.max()) || (x.max() < y.min())) return RT_FALSE;
00046 return (x.assigned() && y.assigned()) ? RT_TRUE : RT_MAYBE;
00047 }
00048
00049 template<class View>
00050 forceinline RelTest
00051 rtest_eq(View x, FloatVal n) {
00052 if ((x.min() > n.max()) || (x.max() < n.min())) return RT_FALSE;
00053 return x.assigned() ? RT_TRUE : RT_MAYBE;
00054 }
00055
00056 template<class View>
00057 forceinline RelTest
00058 rtest_lq(View x, View y) {
00059 if (x.max() <= y.min()) return RT_TRUE;
00060 if (x.min() > y.max()) return RT_FALSE;
00061 return RT_MAYBE;
00062 }
00063
00064 template<class View>
00065 forceinline RelTest
00066 rtest_lq(View x, FloatVal n) {
00067 if (x.max() <= n.min()) return RT_TRUE;
00068 if (x.min() > n.max()) return RT_FALSE;
00069 return RT_MAYBE;
00070 }
00071
00072 template<class View>
00073 forceinline RelTest
00074 rtest_le(View x, View y) {
00075 if (x.max() < y.min()) return RT_TRUE;
00076 if (x.min() >= y.max()) return RT_FALSE;
00077 return RT_MAYBE;
00078 }
00079
00080 template<class View>
00081 forceinline RelTest
00082 rtest_le(View x, FloatVal n) {
00083 if (x.max() < n.min()) return RT_TRUE;
00084 if (x.min() >= n.max()) return RT_FALSE;
00085 return RT_MAYBE;
00086 }
00087
00088 }}
00089
00090
00091