[m-rev.] for review: improve documentation for float__pow
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Jul 4 19:24:00 AEST 2001
This is in response to a discussion thread on mercury-users a while back.
It turns out that the final version of LIA-2 says that pow(0.0, 0) = 1.0.
If LIA-2 and R.A.O'K. are in agreement on this issue, that's good enough
for me.
Estimated hours taken: 2
library/float.m:
Improve the documentation for float__pow.
In particular, document that pow(0.0, 0) = 1.0.
This behaviour for pow(float, int) is specified by LIA-2.
Workspace: /home/mercury0/fjh/mercury
Index: library/float.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/float.m,v
retrieving revision 1.34
diff -u -d -r1.34 float.m
--- library/float.m 2001/03/15 07:42:22 1.34
+++ library/float.m 2001/07/04 08:51:02
@@ -136,8 +136,9 @@
% pow(Base, Exponent) returns Base raised to the power Exponent.
% The exponent must be an integer greater or equal to 0.
- % Currently this function runs at O(n), where n is the value
- % of the exponent.
+ % pow(0.0, 0) is defined to return 1.0.
+ % In the current implementation, this function takes O(n) time,
+ % where n is the value of the exponent.
:- func pow(float, int) = float.
% Compute a non-negative integer hash value for a float.
@@ -258,8 +259,10 @@
% float__pow(Base, Exponent, Answer) is true iff Answer is
% Base raised to the power Exponent. The exponent must be an
- % integer greater or equal to 0. Currently this function runs
- % at O(n), where n is the value of the exponent.
+ % integer greater or equal to 0.
+ % pow(0.0, 0) is defined to return 1.0.
+ % In the current implementation, this function takes O(n) time,
+ % where n is the value of the exponent.
:- pragma obsolete(float__pow/3).
:- pred float__pow(float, int, float).
:- mode float__pow(in, in, out) is det.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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