From 7fd6faea64f23ebcb01a8142de8d0b90d96f4d2b Mon Sep 17 00:00:00 2001 From: Theofrastos Mantadelis Date: Thu, 3 Feb 2011 17:20:42 +0100 Subject: [PATCH] flags: fixed an interval bug --- library/flags.yap | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/library/flags.yap b/library/flags.yap index 9e4b047e8..20d318bc1 100644 --- a/library/flags.yap +++ b/library/flags.yap @@ -10,8 +10,8 @@ % Contributions to this file: % Author: Theofrastos Mantadelis % Sugestions: Bernd Gutmann, Paulo Moura -% Version: 0.1 -% Date: 19/11/2010 +% $Date: 2011-02-03 17:19:26 +0100 (Thu, 03 Feb 2011) $ +% $Revision: 9 $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -337,26 +337,30 @@ in_interval_conj(Type, [Interval|Rest]):- in_interval_conj(Type, Rest). in_interval_single(Type, ([Min], [Max])):- - !, call(Type, Min), + !, call(Type, Min), call(Type, Max), Min =< Max. in_interval_single(Type, ([Min], Max)):- - !, call(Type, Min), - call(Type, Max), + !, call(Type, Min), + type_or_inf(Type, Max), Min < Max. in_interval_single(Type, (Min, [Max])):- - !, call(Type, Min), + !, type_or_inf(Type, Min), call(Type, Max), Min < Max. in_interval_single(Type, (Min, Max)):- - call(Type, Min), - call(Type, Max), + type_or_inf(Type, Min), + type_or_inf(Type, Max), Min < Max, Max - Min > 0.0. +type_or_inf(_Type, (+inf)):- !. +type_or_inf(_Type, (-inf)):- !. +type_or_inf(Type, Value):- call(Type, Value). + in_interval(Type, [Interval|_Rest], Value):- in_interval(Type, Interval, Value), !. in_interval(Type, [_Interval|Rest], Value):-