[m-dev.] for review: obsolete predicates in float.m

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Mar 15 11:01:52 AEDT 1999


On 15-Mar-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> library/float.m:
> 	Uncomment some `:- pragma obsolete' declarations, since the
> 	bug that caused them to be commented out was fixed years ago.
> 
> 	Add `:- pragma obsolete' declarations for some predicate versions
> 	of functions, and move them out of the Library Reference Manual.
> 
> 	Define obselete predicates in terms of non-obsolete functions
> 	rather than the other way around.
>
> NEWS:
> 	Document the obsolete predicates.

Thanks, Simon, that looks great. 

I do have some comments, however.

...
> 	Add `uo' modes for the floating point system constant functions.

This bit (adding `uo' modes) is unrelated to the other changes and should
therefore ideally be committed as a separate change.
You should also explain the rationale for adding `uo' modes in the
log message for this separate change.
I'm not _entirely_ sure that this change is a good idea, since it
does have a cost: it could make those functions less efficient.
So we need to weigh up the benefits and the costs carefully.

...
> Index: NEWS
...
> +  The following predicates are now obsolete, and will be
> +  removed in a future release:
> +	float__ceiling_to_int/2,
...
> +	float__max_exponent/1.

You should explain why they are obsolete and what people should use instead.

> Index: library/float.m
...
> +/* The following predicates are obsolete.  Don't use them.
> +   They will eventually disappear in some future release.
> +*/

Likewise here.

Also, for consistency I suggest you use

	%
	% ...
	% ...
	%

rather than

	/* ...
	   ...
	*/

>  	% float__floor_to_int(X, Floor) is true if Floor is the
>  	% largest integer not greater than X.
> -:- pragma c_code(float__floor_to_int(X :: in, Floor :: out),
> +:- pragma c_code(float__floor_to_int(X :: in) = (Floor :: out),

You should update the comment.

>  	% 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 c_code(float__round_to_int(X :: in, Round :: out),
> +:- pragma c_code(float__round_to_int(X :: in) = (Round :: out),

Ditto.

>  	% float__truncate_to_int(X, Trunc) is true if Trunc is
>  	% the integer closest to X such that |Trunc| =< |X|.
> -:- pragma c_code(float__truncate_to_int(X :: in, Trunc :: out),
> +:- pragma c_code(float__truncate_to_int(X :: in) = (Trunc :: out),
>  	[will_not_call_mercury, thread_safe],
>  "
>  	Trunc = (Integer) X;
>  ").

Ditto.

Otherwise, that looks great -- thanks.

I'd like to see another diff just to make sure those issues mentioned
above have been addressed.

Cheers,
	Fergus.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list