[m-dev.] ICFP Contest: new planning idea
Michael Day
mikeday at yeslogic.com
Mon Jun 30 13:35:55 AEST 2003
> In answer to your question `how big are the discrepancies', they start
> off small (no difference until line 277 of dump) and end up huge (speed
> on last line is 11869473 vs 13692, with accordingly large differences in
> position.)
Have you implemented mul and div with long long?
I get no discrepancies with this implementation:
:- pragma foreign_proc(c, mul(A::in, B::in) = (Prod::out),
[will_not_call_mercury, thread_safe, promise_pure], "
{
long long AL = A;
long long BL = B;
long long PL = (AL * BL) >> 16;
Prod = PL;
}
").
:- pragma foreign_proc(c, div(A::in, B::in) = (Quot::out),
[will_not_call_mercury, thread_safe, promise_pure], "
{
long long AL = A;
long long BL = B;
long long QL = (AL << 16) / BL;
Quot = QL;
}
").
sin and cos are implemented the obvious way, and the state update is also
just implemented by copying the spec function for function.
So far we have completed every track except for PhilAndSimon, which
appears to have been designed specifically to frustrate human drivers :/
Michael
--
YesLogic Prince prints XML!
http://yeslogic.com
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list