[m-rev.] for review: implement float library for Java
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Dec 11 15:43:58 AEDT 2003
On 11-Dec-2003, James Goddard <goddardjames at yahoo.com> wrote:
>
> Implement some library functions for the Java back-end.
>
> library/float.m:
This diff looks good.
But I have some comments on some minor layout issues.
> +:- pragma foreign_proc("Java",
> + float__ceiling_to_int(X :: in) = (Ceil :: out),
> + [will_not_call_mercury, promise_pure, thread_safe],
> +"
> + if( X > (double)java.lang.Integer.MAX_VALUE ||
> + X <= (double)java.lang.Integer.MIN_VALUE - 1 ){
s/if( X/if (X/
s/1 )/1)/
s/> /> /
s/(double)/(double) /
In cases like this where the condition wraps over more than one
line, the "{" should go on a new line.
> + throw( new RuntimeException(
> + ""Overflow converting floating point to int"")
> + );
The outer parentheses are not needed.
Also, please fully qualify all Java names:
throw new java.lang.RuntimeException(
""Overflow converting floating point to int"");
> + } else {
> + Ceil = (int)java.lang.Math.ceil(X);
s/(int)/(int) /
All of the above-mentioned issues apply similarly
for your definitions of the other conversion functions.
> @@ -479,12 +572,12 @@
> % For C, the floating-point system constants are derived from <float.h> and
> % implemented using the C interface.
> %
> -% For .NET, the values are mostly hard-coded.
> +% For .NET (and java), the values are mostly hard-coded.
s/java/Java/
Could you please fix the issues mentioned above, and the ones that
Ralph mentioned, and post a new diff?
--
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