[m-dev.] ICFP Contest: located some problems in fix.m, fixing

Peter Moulder pmoulder at mail.csse.monash.edu.au
Mon Jun 30 00:20:00 AEST 2003


On Mon, Jun 30, 2003 at 12:00:45AM +1000, Peter Moulder wrote:
> On Sun, Jun 29, 2003 at 11:34:13PM +1000, Peter Moulder wrote:
> 
> > However, currently the two dumps don't match.
> > I haven't yet found the cause of the discrepancy.

I've addressed problems found by tst_fixed.m, but there remain
discrepancies in the produced dumps.

Btw, I believe the following fix (or rather the underlying bug)
highlights a weakness of Mercury:

  -cos(X) = CosX :-
  -    X1   = X + half_pi_fix,
  -    X2   = ( if X > pi_fix then X1 - two_pi_fix else X1 ),
  +cos(X0) = CosX :-
  +    X1   = X0 + half_pi_fix,
  +    X2   = ( if X1 > pi_fix then X1 - two_pi_fix else X1 ),
       CosX = sin(X2).

I think the bug arises in part because Mercury has no equivalent of
`x += 5'.  State vars would have been enough to avoid this bug here,
but they would also be inconvenient here (explicit `some[!X] (!:X = X,
...' required).

I need to go home now, so won't keep looking to find the cause of the
discrepancy.  However, I will add a subdirectory containing what I got
up to in implementing car.m before Ralph replied saying that he'd done
that bit.

pjm.

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