[m-rev.] for review: math library bug fix (further explanation)

James Goddard goddardjames at yahoo.com
Thu Dec 11 14:03:49 AEDT 2003


Estimated hours taken: 0.25
Branches: main

Bug fix for math library.

library/math.m:
	Changed the order of the parameters for the mercury implementation of
		math__log_2/2

	Sorry, more details:
	The old version is incorrect with respect to the library documentation.
	'math__log(B, X) = Log' is supposed to return Log as the logarithm to
	base B of X.  After doing domain checks, this predicate calls
	math__log_2(B, X), which is defined correctly for the C and C#
	implementations, but had the parameters the wrong way around for the
	(default) mercury implementation, so it in fact returned Log as the
	logarithm to base X of B (in other words the reciprocal of what was
	intended).

Index: math.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/math.m,v
retrieving revision 1.46
diff -u -d -r1.46 math.m
--- math.m	10 Dec 2003 04:35:23 -0000	1.46
+++ math.m	11 Dec 2003 02:41:27 -0000
@@ -641,7 +641,7 @@
 	Log = System.Math.Log(X, B);
 ").
 % Java implementation will default to mercury here.
-math__log_2(X, B) = math__ln_2(X) / math__ln_2(B).
+math__log_2(B, X) = math__ln_2(X) / math__ln_2(B).
 
 %
 % math__sin(X) = Sin is true if Sin is the sine of 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