[m-dev.] For review: minor changes to int.m

Ralph Becket rbeck at microsoft.com
Tue Feb 6 00:29:09 AEDT 2001


Estimated hours taken: 0.2

library/int.m:
	Added func versions of all preds implementing functions.
	Added `pragma obsolete' declarations to all preds that have
	equivalent functions, as well as int__is/2.
	Changed comments in the interface as appropriate.

NEWS:
	Made a note of the above in the section on changes to the
	library.

Index: int.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.72
diff -u -r1.72 int.m
--- int.m	2001/01/01 04:03:50	1.72
+++ int.m	2001/02/05 13:23:34
@@ -43,30 +43,47 @@
 :- mode in >= in is semidet.
 
 	% absolute value
+:- func int__abs(int) = int.
+
+:- pragma obsolete(int__abs/2).
 :- pred int__abs(int, int).
 :- mode int__abs(in, out) is det.
 
 	% maximum
+:- func int__max(int, int) = int.
+
+:- pragma obsolete(int__max/3).
 :- pred int__max(int, int, int).
 :- mode int__max(in, in, out) is det.
 
 	% minimum
+:- func int__min(int, int) = int.
+
+:- pragma obsolete(int__min/3).
 :- pred int__min(int, int, int).
 :- mode int__min(in, in, out) is det.
 
 	% conversion of integer to floating point
+	% OBSOLETE: use float__float/1 instead.
+:- pragma obsolete(int__to_float/2).
 :- pred int__to_float(int, float) is det.
 :- mode int__to_float(in, out) is det.
 
 	% expontiation
 	% int__pow(X, Y, Z): Z is X raised to the Yth power
 	% Y must not be negative.
+:- func int__pow(int, int) = int.
+
+:- pragma obsolete(int__pow/3).
 :- pred int__pow(int, int, int).
 :- mode int__pow(in, in, out) is det.
 
 	% base 2 logarithm
-	% int__log2(X, N): N is the least integer such that 2 to the power N
-	% is greater than or equal to X.  X must be positive.
+	% int__log2(X) = N is the least integer such that 2 to the
+	% power N is greater than or equal to X.  X must be positive.
+:- func int__log2(int) = int.
+
+:- pragma obsolete(int__log2/2).
 :- pred int__log2(int, int).
 :- mode int__log2(in, out) is det.
 
@@ -179,28 +196,32 @@
 
 	% is/2, for backwards compatiblity with Prolog (and with
 	% early implementations of Mercury)
+:- pragma obsolete(int__is/2).
 :- pred is(T, T) is det.
 :- mode is(uo, di) is det.
 :- mode is(out, in) is det.
 
-	% int__max_int(Max) binds Max to the maximum value of an int
+	% int__max_int is the maximum value of an int
 	% on this machine.
-:- pred int__max_int(int::out) is det.
-
 :- func int__max_int = int.
 
-	% int__min_int(Max) binds Min to the minimum value of an int
-	% on this machine.
-:- pred int__min_int(int::out) is det.
+:- pragma obsolete(int__max_int/1).
+:- pred int__max_int(int::out) is det.
 
+	% int__min_int is the minimum value of an int
+	% on this machine.
 :- func int__min_int = int.
 
-	% int__bits_per_int(Bits) binds Bits to the number of bits in an int
-	% on this machine.
-:- pred int__bits_per_int(int::out) is det.
+:- pragma obsolete(int__min_int/1).
+:- pred int__min_int(int::out) is det.
 
+	% int__bits_per_int is the number of bits in an int
+	% on this machine.
 :- func int__bits_per_int = int.
 
+:- pragma obsolete(int__bits_per_int/1).
+:- pred int__bits_per_int(int::out) is det.
+
 
%---------------------------------------------------------------------------
--%
 
%---------------------------------------------------------------------------
--%
 
@@ -374,6 +395,9 @@
 		)
 	).
 
+int__abs(Num) = Abs :-
+	int__abs(Num, Abs).
+
 int__abs(Num, Abs) :-
 	(
 		Num < 0
@@ -383,6 +407,9 @@
 		Abs = Num
 	).
 
+int__max(X, Y) = Max :-
+	int__max(X, Y, Max).
+
 int__max(X, Y, Max) :-
 	(
 		X > Y
@@ -392,6 +419,9 @@
 		Max = Y
 	).
 
+int__min(X, Y) = Min :-
+	int__min(X, Y, Min).
+
 int__min(X, Y, Min) :-
 	(
 		X < Y
@@ -401,6 +431,9 @@
 		Min = Y
 	).
 
+int__pow(Val, Exp) = Result :-
+	int__pow(Val, Exp, Result).
+
 int__pow(Val, Exp, Result) :-
 	( Exp < 0 ->
 		error("int__pow: negative exponent")
@@ -419,6 +452,9 @@
 		Result1 is Result0 * Val,
 		int__pow_2(Val, Exp1, Result1, Result)
 	).
+
+int__log2(X) = N :-
+	int__log2(X, N).
 
 int__log2(X, N) :-
 	( X > 0 ->

--
Ralph Becket      |      MSR Cambridge      |      rbeck at microsoft.com 
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list