flags: fixed an interval bug

This commit is contained in:
Theofrastos Mantadelis 2011-02-03 17:20:42 +01:00
parent 3efb549e02
commit 7fd6faea64
1 changed files with 12 additions and 8 deletions

View File

@ -10,8 +10,8 @@
% Contributions to this file: % Contributions to this file:
% Author: Theofrastos Mantadelis % Author: Theofrastos Mantadelis
% Sugestions: Bernd Gutmann, Paulo Moura % Sugestions: Bernd Gutmann, Paulo Moura
% Version: 0.1 % $Date: 2011-02-03 17:19:26 +0100 (Thu, 03 Feb 2011) $
% Date: 19/11/2010 % $Revision: 9 $
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
@ -337,26 +337,30 @@ in_interval_conj(Type, [Interval|Rest]):-
in_interval_conj(Type, Rest). in_interval_conj(Type, Rest).
in_interval_single(Type, ([Min], [Max])):- in_interval_single(Type, ([Min], [Max])):-
!, call(Type, Min), !, call(Type, Min),
call(Type, Max), call(Type, Max),
Min =< Max. Min =< Max.
in_interval_single(Type, ([Min], Max)):- in_interval_single(Type, ([Min], Max)):-
!, call(Type, Min), !, call(Type, Min),
call(Type, Max), type_or_inf(Type, Max),
Min < Max. Min < Max.
in_interval_single(Type, (Min, [Max])):- in_interval_single(Type, (Min, [Max])):-
!, call(Type, Min), !, type_or_inf(Type, Min),
call(Type, Max), call(Type, Max),
Min < Max. Min < Max.
in_interval_single(Type, (Min, Max)):- in_interval_single(Type, (Min, Max)):-
call(Type, Min), type_or_inf(Type, Min),
call(Type, Max), type_or_inf(Type, Max),
Min < Max, Min < Max,
Max - Min > 0.0. 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|_Rest], Value):-
in_interval(Type, Interval, Value), !. in_interval(Type, Interval, Value), !.
in_interval(Type, [_Interval|Rest], Value):- in_interval(Type, [_Interval|Rest], Value):-