From jan@swi.psy.uva.nl  Wed May 10 09:59:25 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 JAA15005;
	Wed, 10 May 2000 09:59:25 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id JAA21152;
	Wed, 10 May 2000 09:59:36 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: ino-waiting@gmx.net, prolog@swi.psy.uva.nl
Subject: Re: handling small numbers
Date: Wed, 10 May 2000 09:49:27 +0200
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <200005100257.OAA31206@atlas.otago.ac.nz> <20000510082155.C1285@spotteswoode.de>
In-Reply-To: <20000510082155.C1285@spotteswoode.de>
MIME-Version: 1.0
Message-Id: <00051009593601.21111@gollem>
Content-Transfer-Encoding: 8bit

On Wed, 10 May 2000, ino-waiting@gmx.net wrote:
>> Richard A. O'Keefe (Wed 10.0500-14:57):
>> It has been possible to go off and do something else for longer than
>> SWI Prolog has existed, thanks to the freely available LONG.PL.
>
>where can i get LONG.PL?
>
>>     ?- quotient_and_remainder(70000, 70000, 0, 10000, Q, R).
>> 
>> blows up:
>>     ERROR: ///2: Type error: `integer' expected, found `4.9e+09'
>>     ^  Exception: (7) _G454 is 4.9e+09//10000 ? 
>> 
>> [...]
>> 
>> >From my point of view, the problem here is a bug in SWI Prolog.
>> It has raise the wrong exception and the wrong point.
>> The *real* problem is that the multiplication of 70000 by 70000
>> overflowed.
>
>agreed.  the exception is ok, but should be raised earlier on the integer
>multiplication overflow.  if type promotion were to be employed, it could
>engage bigints, but only if all operators were overloaded properly and the
>external representation wouldn't change.  and since this is a tricky thing,
>one should silently use bigints in the first place, =unless= the user is
>advised of the restricted range of input values to quotient_and_reminder/6.
>not doing so and not using a bigint package is bad design, in other words,
>doing so or using a bigint package is good design 7^)
>
>> Anything that separates the symptom from the cause is regrettable.
>
>very true.  i'd like to see this attitude applied to this discussion thread.

All in all, I think I vote for the introduction of a prolog flag. 
Basically, to an engineer 100000000 =:= 100000000.0 (and =~=
100000000.1), but to a mathematician this is complete nonsense (and
actually floats by themselves are very close to nonsense :-).

This flag can also deal with 4.5 @< 3, which is true according to ISO
Prolog, but false in SWI-Prolog default's behaviour (true if the iso
flag is set to true).  To an engineer, doing sort/2 on an array of mixed
floats and ints and getting all floats in front is pretty weird.

So, this flag should basically tell Prolog whether or not floats and
ints should both be regarded as coming from one space or not.  A
suggestion for a good name?

	Regards --- Jan

