Hi,

  I want to write a module which would have a number which would 
be a float and then it should be rounded to the nearest number. At 
each stage it should be displayed on the screen. But I get errors 
, plz do help me solve it.

:- module 'Nex_int'.

:- interface.
:- import_module io.
:- pred main(io__state, io__state).
:- mode main(di, uo) is det.

:- implementation.
:- import_module math, float.
main --> { Radius = 10.5 }, print(Radius), {Radius = 
math__round(Radius)}, print(Radius).

Here is the error...
Nex_int.m:006: In `main(di, uo)':
Nex_int.m:006:   error: determinism declaration not satisfied.
Nex_int.m:006:   Declared `det', inferred `semidet'.
Nex_int.m:010:   In the return value of call to function 
`math:round/1':
Nex_int.m:010:   unification with `Radius' can fail.

Whatever I try by changing its determinism, it does not solve the 
problem. Plz do help.

> > 2) I would like to know how do I use math__ceiling, 
>math__floor
> > and math__truncate? It is a bit confusing as to how to apply 
>the
> > logic for writng the code.
>
>You use that in the same way than in your example, instantiating 
>logic
>variables or comparing values, like in
>
>math__ceiling(Num) = math__round(Num)
if math__ceiling is used like this, then what is the need for such 
operations. Why cant it be like having some fixed number which 
would be a ceiling or the top limit rather than having it like 
this.
What is the need of math__ceiling, math__floor, math__truncate? 
Plz do tell me how it is used in more detail.

Regards,

Noel

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users@cs.mu.oz.au
administrative address: owner-mercury-users@cs.mu.oz.au
unsubscribe: Address: mercury-users-request@cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request@cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------

