[m-dev.] diff: cleanup of tabling

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Jan 4 17:06:02 AEDT 2000


> Hmm... tabling is an implementation-specific extension
> (it's listed in the "implementation-dependent extensions"
> chapter of the Mercury language reference manual).
> Given that, I don't think that it is a good idea to include
> features in the standard library that only make sense in
> the presence of tabling.

How about a io__report_impl_defined_stats predicate, which takes
a string as an argument, and when that string is "tabling", prints
tabling stats. The set of strings which have meaningful actions
would of course be implementation defined.

Note that the existing io__report_stats and io__report_full_memory_stats
output different information depending on the grade, and would therefore
be expected to behave differently in different implementations, so maybe
they should be folded into this new predicate.

> > +#define	hash(key)		(hash_float(key))
> > +#define	equal_keys(k1, k2)	(k1 == k2)
> 
> Using `==' to compare floats could cause problems with NaNs.
> That is probably worth at least an XXX comment.

It would be better to fix it. In this case, we want bitwise equality;
we want to file NaNs separarely from PosInfs, underflows etc as well
as from ordinary floats.

One way would be to define a union of a Float and an appropriately sized
array of chars or ints, put k1 and k2 into the float fields of two unions,
and check the equality of the char/int array fields. Is there a way to do
this more cleanly in standard C?

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