[m-rev.] for review: remove obsolete library predicates
Zoltan Somogyi
zs at cs.mu.OZ.AU
Mon Dec 31 17:03:33 AEDT 2001
For review by anyone.
Zoltan.
library/float.m:
library/math.m:
Remove obsolete predicates whose jobs are now done by functions.
The existence of the predicate versions made uses of the functions
ambiguous, as (e.g.) X = math__sin(Y) could be read both as a function
application and as the creation of a closure.
The removed predicates were marked obsolete in March 1999, so there has
been ample notice.
cvs diff: Diffing .
Index: float.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/float.m,v
retrieving revision 1.38
diff -u -b -r1.38 float.m
--- float.m 2001/09/06 08:26:46 1.38
+++ float.m 2001/09/30 10:50:56
@@ -194,124 +194,6 @@
%---------------------------------------------------------------------------%
:- implementation.
-:- interface.
-
- % Everything below here will not appear in the
- % Mercury Library Reference Manual.
-
-%---------------------------------------------------------------------------%
-
-%
-% Obsolete predicate versions of the functions declared above.
-% These were intended for use in programs that need to work
-% in both Prolog and Mercury. Running Mercury programs using
-% Prolog is no longer supported.
-%
-
-%
-% Conversion predicates
-%
-
- % float__ceiling_to_int(X, Ceil) is true if Ceil is the
- % smallest integer not less than X.
-:- pragma obsolete(float__ceiling_to_int/2).
-:- pred float__ceiling_to_int(float, int).
-:- mode float__ceiling_to_int(in, out) is det.
-
- % float__floor_to_int(X, Ceil) is true if Ceil is the
- % largest integer not greater than X.
-:- pragma obsolete(float__floor_to_int/2).
-:- pred float__floor_to_int(float, int).
-:- mode float__floor_to_int(in, out) is det.
-
- % float__round_to_int(X, Round) is true if Round is the
- % integer closest to X. If X has a fractional value of
- % 0.5, it is rounded up.
-:- pragma obsolete(float__round_to_int/2).
-:- pred float__round_to_int(float, int).
-:- mode float__round_to_int(in, out) is det.
-
- % float__truncate_to_int(X, Trunc) is true if Trunc is
- % the integer closest to X such that |Trunc| =< |X|.
-:- pragma obsolete(float__truncate_to_int/2).
-:- pred float__truncate_to_int(float, int).
-:- mode float__truncate_to_int(in, out) is det.
-
-%
-% Miscellaneous predicates
-%
-
- % absolute value
-:- pragma obsolete(float__abs/2).
-:- pred float__abs(float, float).
-:- mode float__abs(in, out) is det.
-
- % maximum
-:- pragma obsolete(float__max/3).
-:- pred float__max(float, float, float).
-:- mode float__max(in, in, out) is det.
-
- % minimum
-:- pragma obsolete(float__min/3).
-:- pred float__min(float, float, float).
-:- mode float__min(in, in, out) is det.
-
- % float__pow(Base, Exponent, Answer) is true iff Answer is
- % Base raised to the power Exponent. Currently this function runs
- % at O(n), where n is the value of the exponent.
- % Throws a `math__domain_error' exception if the exponent is negative.
-:- pragma obsolete(float__pow/3).
-:- pred float__pow(float, int, float).
-:- mode float__pow(in, in, out) is det.
-
- % Compute a non-negative integer hash value for a float.
-:- pragma obsolete(float__hash/2).
-:- pred float__hash(float, int).
-:- mode float__hash(in, out) is det.
-
-%
-% System constant predicates
-%
-
- % Maximum floating-point number
-:- pragma obsolete(float__max/1).
-:- pred float__max(float).
-:- mode float__max(out) is det.
-
- % Minimum normalised floating-point number
-:- pragma obsolete(float__min/1).
-:- pred float__min(float).
-:- mode float__min(out) is det.
-
- % Smallest number x such that 1.0 + x \= 1.0
-:- pragma obsolete(float__epsilon/1).
-:- pred float__epsilon(float).
-:- mode float__epsilon(out) is det.
-
- % Radix of the floating-point representation.
-:- pragma obsolete(float__radix/1).
-:- pred float__radix(int).
-:- mode float__radix(out) is det.
-
- % The number of base-radix digits in the mantissa.
-:- pragma obsolete(float__mantissa_digits/1).
-:- pred float__mantissa_digits(int).
-:- mode float__mantissa_digits(out) is det.
-
- % Smallest exponent of a normalised floating-point number.
-:- pragma obsolete(float__min_exponent/1).
-:- pred float__min_exponent(int).
-:- mode float__min_exponent(out) is det.
-
- % Largest exponent of a normalised floating-point number.
-:- pragma obsolete(float__max_exponent/1).
-:- pred float__max_exponent(int).
-:- mode float__max_exponent(out) is det.
-
-%---------------------------------------------------------------------------%
-%---------------------------------------------------------------------------%
-
-:- implementation.
:- import_module exception, int, math.
%
@@ -384,8 +266,6 @@
Ceil = System.Convert.ToInt32(System.Math.Ceiling(X));
").
-float__ceiling_to_int(X, float__ceiling_to_int(X)).
-
% float__floor_to_int(X) returns the
% largest integer not greater than X.
:- pragma foreign_proc("C", float__floor_to_int(X :: in) = (Floor :: out),
@@ -399,8 +279,6 @@
Floor = System.Convert.ToInt32(System.Math.Floor(X));
").
-float__floor_to_int(X, float__floor_to_int(X)).
-
% float__round_to_int(X) returns the integer closest to X.
% If X has a fractional value of 0.5, it is rounded up.
:- pragma foreign_proc("C", float__round_to_int(X :: in) = (Round :: out),
@@ -414,8 +292,6 @@
Round = System.Convert.ToInt32(System.Math.Floor(X + 0.5));
").
-float__round_to_int(X, float__round_to_int(X)).
-
% float__truncate_to_int(X) returns the integer closest
% to X such that |float__truncate_to_int(X)| =< |X|.
:- pragma foreign_proc("C", float__truncate_to_int(X :: in) = (Trunc :: out),
@@ -429,8 +305,6 @@
Trunc = System.Convert.ToInt32(X);
").
-float__truncate_to_int(X, float__truncate_to_int(X)).
-
%---------------------------------------------------------------------------%
%
% Miscellaneous functions
@@ -445,8 +319,6 @@
Abs = Num
).
-float__abs(Num, float__abs(Num)).
-
float__max(X, Y) = Max :-
(
X >= Y
@@ -456,8 +328,6 @@
Max = Y
).
-float__max(X, Y, float__max(X, Y)).
-
float__min(X, Y) = Min :-
(
X =< Y
@@ -467,8 +337,6 @@
Min = Y
).
-float__min(X, Y, float__min(X, Y)).
-
% float_pow(Base, Exponent) = Answer.
% XXXX This function could be more efficient, with an int_mod pred, to
% reduce O(N) to O(logN) of the exponent.
@@ -484,8 +352,6 @@
Ans is X * float__pow(X, New_e)
).
-float__pow(X, Exp, float__pow(X, Exp)).
-
:- pragma foreign_proc("C", float__hash(F::in) = (H::out),
[will_not_call_mercury, thread_safe],
"
@@ -497,8 +363,6 @@
H = F.GetHashCode();
").
-float__hash(F, float__hash(F)).
-
%---------------------------------------------------------------------------%
%
% System constants
@@ -537,8 +401,6 @@
"Max = System.Double.MaxValue;").
-float__max(float__max).
-
% Minimum normalised floating-point number */
:- pragma foreign_proc("C", float__min = (Min::out),
[will_not_call_mercury, thread_safe],
@@ -547,8 +409,6 @@
[will_not_call_mercury, thread_safe],
"Min = System.Double.MinValue;").
-float__min(float__min).
-
% Smallest x such that x \= 1.0 + x
:- pragma foreign_proc("C", float__epsilon = (Eps::out),
[will_not_call_mercury, thread_safe],
@@ -557,8 +417,6 @@
[will_not_call_mercury, thread_safe],
"Eps = System.Double.Epsilon;").
-float__epsilon(float__epsilon).
-
% Radix of the floating-point representation.
:- pragma foreign_proc("C", float__radix = (Radix::out),
[will_not_call_mercury, thread_safe],
@@ -569,8 +427,6 @@
_Radix = 0;
").
-float__radix(float__radix).
-
% The number of base-radix digits in the mantissa.
:- pragma foreign_proc("C", float__mantissa_digits = (MantDig::out),
[will_not_call_mercury, thread_safe],
@@ -581,8 +437,6 @@
_MantDig = 0;
").
-float__mantissa_digits(float__mantissa_digits).
-
% Minimum negative integer such that:
% radix ** (min_exponent - 1)
% is a normalised floating-point number.
@@ -595,8 +449,6 @@
_MinExp = 0;
").
-float__min_exponent(float__min_exponent).
-
% Maximum integer such that:
% radix ** (max_exponent - 1)
% is a normalised floating-point number.
@@ -610,8 +462,6 @@
_MaxExp = 0;
").
-
-float__max_exponent(float__max_exponent).
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
Index: math.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/math.m,v
retrieving revision 1.33
diff -u -b -r1.33 math.m
--- math.m 2001/09/02 12:20:12 1.33
+++ math.m 2001/09/30 10:46:03
@@ -731,213 +731,3 @@
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
-
-/*
-** OBSOLETE OBSOLETE OBSOLETE
-**
-** The predicate forms of the above functions are now deprecated.
-** We provide them for compatibility reasons but they will be removed
-** at a later release. Hence they are tagged `obsolete'.
-*/
-
-:- interface.
-
-%---------------------------------------------------------------------------%
-% Mathematical constants
-
- % Pythagoras' number
-:- pred math__pi(float).
-:- mode math__pi(out) is det.
-:- pragma obsolete(math__pi/1).
-
- % Base of natural logarithms
-:- pred math__e(float).
-:- mode math__e(out) is det.
-:- pragma obsolete(math__e/1).
-
-%---------------------------------------------------------------------------%
-% "Next integer" operations
-
- % math__ceiling(X, Ceil) is true if Ceil is the smallest integer
- % not less than X.
-:- pred math__ceiling(float, float).
-:- mode math__ceiling(in, out) is det.
-:- pragma obsolete(math__ceiling/2).
-
- % math__floor(X, Floor) is true if Floor is the largest integer
- % not greater than X.
-:- pred math__floor(float, float).
-:- mode math__floor(in, out) is det.
-:- pragma obsolete(math__floor/2).
-
- % math__round(X, Round) is true if Round is the integer
- % closest to X. If X has a fractional value of 0.5, it
- % is rounded up.
-:- pred math__round(float, float).
-:- mode math__round(in, out) is det.
-:- pragma obsolete(math__round/2).
-
- % math__truncate(X, Trunc) is true if Trunc is the integer
- % closest to X such that |Trunc| =< |X|.
-:- pred math__truncate(float, float).
-:- mode math__truncate(in, out) is det.
-:- pragma obsolete(math__truncate/2).
-
-%---------------------------------------------------------------------------%
-% Power/logarithm operations
-
- % math__sqrt(X, Sqrt) is true if Sqrt is the positive square
- % root of X.
- %
- % Domain restriction: X >= 0
-:- pred math__sqrt(float, float).
-:- mode math__sqrt(in, out) is det.
-:- pragma obsolete(math__sqrt/2).
-
- % math__pow(X, Y, Res) is true if Res is X raised to the
- % power of Y.
- %
- % Domain restriction: X >= 0 and (X = 0 implies Y > 0)
-:- pred math__pow(float, float, float).
-:- mode math__pow(in, in, out) is det.
-:- pragma obsolete(math__pow/3).
-
- % math__exp(X, Exp) is true if Exp is X raised to the
- % power of e.
-:- pred math__exp(float, float).
-:- mode math__exp(in, out) is det.
-:- pragma obsolete(math__exp/2).
-
- % math__ln(X, Log) is true if Log is the natural logarithm
- % of X.
- %
- % Domain restriction: X > 0
-:- pred math__ln(float, float).
-:- mode math__ln(in, out) is det.
-:- pragma obsolete(math__ln/2).
-
- % math__log10(X, Log) is true if Log is the logarithm to
- % base 10 of X.
- %
- % Domain restriction: X > 0
-:- pred math__log10(float, float).
-:- mode math__log10(in, out) is det.
-:- pragma obsolete(math__log10/2).
-
- % math__log2(X, Log) is true if Log is the logarithm to
- % base 2 of X.
- %
- % Domain restriction: X > 0
-:- pred math__log2(float, float).
-:- mode math__log2(in, out) is det.
-:- pragma obsolete(math__log2/2).
-
- % math__log(B, X, Log) is true if Log is the logarithm to
- % base B of X.
- %
- % Domain restriction: X > 0 and B > 0 and B \= 1
-:- pred math__log(float, float, float).
-:- mode math__log(in, in, out) is det.
-:- pragma obsolete(math__log/3).
-
-%---------------------------------------------------------------------------%
-% Trigonometric operations
-
- % math__sin(X, Sin) is true if Sin is the sine of X.
-:- pred math__sin(float, float).
-:- mode math__sin(in, out) is det.
-:- pragma obsolete(math__sin/2).
-
- % math__cos(X, Cos) is true if Cos is the cosine of X.
-:- pred math__cos(float, float).
-:- mode math__cos(in, out) is det.
-:- pragma obsolete(math__cos/2).
-
- % math__tan(X, Tan) is true if Tan is the tangent of X.
-:- pred math__tan(float, float).
-:- mode math__tan(in, out) is det.
-:- pragma obsolete(math__tan/2).
-
- % math__asin(X, ASin) is true if ASin is the inverse
- % sine of X, where ASin is in the range [-pi/2,pi/2].
- %
- % Domain restriction: X must be in the range [-1,1]
-:- pred math__asin(float, float).
-:- mode math__asin(in, out) is det.
-:- pragma obsolete(math__asin/2).
-
- % math__acos(X, ACos) is true if ACos is the inverse
- % cosine of X, where ACos is in the range [0, pi].
- %
- % Domain restriction: X must be in the range [-1,1]
-:- pred math__acos(float, float).
-:- mode math__acos(in, out) is det.
-:- pragma obsolete(math__acos/2).
-
- % math__atan(X, ATan) is true if ATan is the inverse
- % tangent of X, where ATan is in the range [-pi/2,pi/2].
-:- pred math__atan(float, float).
-:- mode math__atan(in, out) is det.
-:- pragma obsolete(math__atan/2).
-
- % math__atan2(Y, X, ATan) is true if ATan is the inverse
- % tangent of Y/X, where ATan is in the range [-pi,pi].
-:- pred math__atan2(float, float, float).
-:- mode math__atan2(in, in, out) is det.
-:- pragma obsolete(math__atan2/3).
-
-%---------------------------------------------------------------------------%
-% Hyperbolic functions
-
- % math__sinh(X, Sinh) is true if Sinh is the hyperbolic
- % sine of X.
-:- pred math__sinh(float, float).
-:- mode math__sinh(in, out) is det.
-:- pragma obsolete(math__sinh/2).
-
- % math__cosh(X, Cosh) is true if Cosh is the hyperbolic
- % cosine of X.
-:- pred math__cosh(float, float).
-:- mode math__cosh(in, out) is det.
-:- pragma obsolete(math__cosh/2).
-
- % math__tanh(X, Tanh) is true if Tanh is the hyperbolic
- % tangent of X.
-:- pred math__tanh(float, float).
-:- mode math__tanh(in, out) is det.
-:- pragma obsolete(math__tanh/2).
-
-%---------------------------------------------------------------------------%
-%---------------------------------------------------------------------------%
-
-:- implementation.
-
-% These operations are all implemented in terms of the functional versions.
-
-
-pi(pi).
-e(e).
-ceiling(X, ceiling(X)).
-floor(X, floor(X)).
-round(X, round(X)).
-truncate(X, truncate(X)).
-sqrt(X, sqrt(X)).
-pow(X, Y, pow(X, Y)).
-exp(X, exp(X)).
-ln(X, ln(X)).
-log10(X, log10(X)).
-log2(X, log2(X)).
-log(X, Y, log(X, Y)).
-sin(X, sin(X)).
-cos(X, cos(X)).
-tan(X, tan(X)).
-asin(X, asin(X)).
-acos(X, acos(X)).
-atan(X, atan(X)).
-atan2(X, Y, atan2(X, Y)).
-sinh(X, sinh(X)).
-cosh(X, cosh(X)).
-tanh(X, tanh(X)).
-
-%---------------------------------------------------------------------------%
-%---------------------------------------------------------------------------%
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list