[m-rev.] for review: float__pow: accept negative exponent; Russian peasants alg

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Mar 4 16:15:28 AEDT 2002


On 28-Feb-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> In the interests of clarity, I'd rather see you use Exp // 2 than
> unchecked_right_shift(Exp, 1) and let the compiler do the obvious
> optimization.

That would be fine if the compiler actually did the obvious optimization,
but in our current implementation, it doesn't.

Another alternative would be to write it as `half(Exp)', and then define

	half(X) = X `unchecked_right_shift` 1.

But personally I think this particular algorithm is probably just as clear
when written using explicit bit operations directly.

> Similarly, I'd like to see even/1 go in int.m rather than use the idiom
> Exp /\ 1 = 0.

I'm not convinced that even/1 is used often enough to justify its
inclusion in the standard library interface.

> My last (very minor) niggle is that I feel the compiler should perform
> accumulator introduction automatically...  Since it *can* do such a
> thing, I'd like to see it happen in the library at least since the
> head recursive code is easier to read.

Accumulator introduction is still not enabled by default, even at -O6.

-- 
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