% For Prova 1.6.3 or later.
% Demonstrate updated arithmetic and types processing.

:- eval(ex007()).

ex007() :-
	% 5 is an Integer but is converted dynamically to 'short' that the
	%    java.lang.Short constructor requires
	% Note that Short is java.lang.Short, because the java.lang prefix is always
	%    tested for all potential class names. 
	S = Short(5),
	% S is now a java.lang.Short but it is compared with an Integer.
	% It now presents no problem as S is dynamically converted to Integer
	%   before comparison. 
	S>4,
	println([S,">4"]).
ex007() :-
	L = Long(5),
	L>4,
	println([L,">4"]).
ex007() :-
	D = Double(5),
	D>4,
	println([D,">4"]).
ex007() :-
	F = Float(5),
	F>4,
	println([F,">4"]).
ex007() :-
	% <= and >= now work too
	3<=4,
	println(["3<=4"]),
	I = Integer(4),
	% division and multiplication can be used
	D = 3.14 / I,
	println(["D=3.14/4=",D]).
ex007() :-
	I = Integer(4),
	% remainder is represented by a // operator
	Mod = 10 // I,   % 10 mod I
	println(["Mod=10%4=",Mod]).
ex007() :-
	% Another way of instantiating a java.lang.Short
	S = java.lang.Short.decode("5"),
	S>4,
	println([S,">4"]).

%equ(A, B) 	:- Boolean.TRUE = eca.Math.equ(A, B).
