[mercury-users] float__min

David Glen JEFFERY dgj at cs.mu.OZ.AU
Thu Jan 7 14:59:50 AEDT 1999


On 07-Jan-1999, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> 
> The only thing you do with F is print it.
> io__print is pretty generic -- it doesn't provide any extra type information.
> 
> If you add a goal such as
> 	{ _X = F + 0.0 }
> this will clearly mark F as being of type `float' (unless you define
> a `+' that works on things of type `func(float, float) = float').
> But it's a bit ugly.
> 
> You could use a print statement such as io__write_float instead of
> io__print -- this will make it clear that F is of type `float'
> 
> Or you can write a predicate is_float(float::in) which is always
> true, and use it on F to make sure it is a float.

I should point out that one day (RSN...) you will be able to do this much more
conveniently by using a type qualifier. I'm not sure if the syntax has been
completely decided upon, but you'll be able to do something like:

	...
	io__print(F:float)
	...


HTH.


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
PhD student,                    |  Homer: Noooo.  I swear on this Bible!
Dept. of Comp. Sci. & Soft. Eng.|  Marge: That's not a Bible; that's a book of
University of Melbourne         |         carpet samples!
Australia                       |  Homer: Ooooh... Fuzzy.




More information about the users mailing list