From jan@swi.psy.uva.nl  Fri May  5 13:20:54 2000
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id NAA15174;
	Fri, 5 May 2000 13:20:54 +0200 (MET DST)
Received: (from jan@localhost)
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id NAA01964;
	Fri, 5 May 2000 13:21:02 +0200
Date: Fri, 5 May 2000 13:21:02 +0200
Message-Id: <200005051121.NAA01964@gollem.swi.psy.uva.nl>
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Subject: Re: handling small numbers (fwd)
To: Nicos Angelopoulos <nangelop@csd.abdn.ac.uk>, prolog@swi.psy.uva.nl
In-Reply-To: Nicos Angelopoulos's message of Fri, 5 May 2000 11:25:48 +0100
Phone: +31 - 20 - 525 6121

> gcd( M, N, C ) :-
>         ( N =:= 0 -> C is M
>                   ;  NewN is M mod N,
>                      gcd( N, NewN, C )
>         ).

This little program will benefit a lot from pl-3.3.6 and using -O.
3.3.6 has a much better implementation of if -> then ; else and -O
optimises arithmetic to compile to a stack-engine instead of the
default: building the expression and evaluating it by is/2 (problem
is to can't trace optimised arithmetic as noting is `called').

Op course you can also write it in C.  It is a trivial exercise.

	Regards --- Jan

P.s.	For all you number crunchers, you might have a look at the
	mp package for SWI-Prolog.

