Re: Question about the real and integer formats

From: <wh_at_icparc.ic.ac.uk>
Date: Fri 08 Jul 2005 08:39:35 AM GMT
Message-ID: <20050708083935.GA32048@tempest.icparc.ic.ac.uk>
On Fri, Jul 08, 2005 at 09:56:15AM +0200, ludovic picouays wrote:
> I want to convert a real number (1.0) to an integer (1) format.
> I've been searching for some time  but I didn't find anything to do
> this. I think it's simple but I don't have the solution or the
> predicate to do that.

You're looking for fix/2.  For example:

    Integer is fix(Real)

Often you'll want to round the real number appropriately first (round/2,
floor/2, ceiling/2) rather than relying on fix's truncation.

See the documentation for is/2 and fix/2.

Cheers,
Warwick
Received on Fri Jul 08 09:44:42 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:37 PM GMT GMT