Re: [eclipse-users] Operators in Eclipse

From: Warwick Harvey <wh_at_crosscoreop.com>
Date: Thu, 5 Apr 2007 19:16:21 +0100
Hi all,

On Thu, Apr 05, 2007 at 12:43:01AM +0100, Joachim Schimpf (Independent Contractor) wrote:
> I guess you mean by "integer quotient" the quotient rounded
> (down?) to the next integer?  You can define that as follows:
> 
> fdiv(Dividend, Divisor, Quotient, Remainder) :-
> 	Remainder #>=0, Remainder #< Divisor,
> 	Dividend #= Quotient*Divisor + Remainder.

Minor improvement/correction that means it will work with negative divisors:

fdiv(Dividend, Divisor, Quotient, Remainder) :-
 	Remainder #>=0, Remainder #< abs(Divisor),
 	Dividend #= Quotient*Divisor + Remainder.

Cheers,
Warwick
-- 
!umop apisdn papuadsns w,I - aW dlaH aseald
Received on Thu Apr 05 2007 - 19:16:22 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:57 CET