Fwd: Preliminary draft for the revised ISO Prolog core standard

From: Paulo Moura <pmoura_at_di.ubi.pt>
Date: Thu, 16 Nov 2006 18:55:00 +0000

Begin forwarded message:

> From: Jan Wielemaker <wielemak_at_science.uva.nl>
> Date: 16 de novembro de 2006 08:53:40 GMT+00:00
> To: Bart Demoen <Bart.Demoen_at_cs.kuleuven.ac.be>
> Cc: ok_at_cs.otago.ac.nz, Daniel.Diaz_at_inria.fr,
> Remy.Haemmerle_at_inria.fr, amd_at_di.fct.unl.pt, bagnara_at_cs.unipr.it,
> herme_at_clip.dia.fi.upm.es, jhodgson_at_sju.edu, jpaulo_at_di.ubi.pt,
> kbowen_at_als.com, kostis_at_user.it.uu.se, mary_at_amzi.com, matsc_at_sics.se,
> mc_at_declarativa.com, mc_at_uga.edu, mcarro_at_fi.upm.es,
> nakamura_at_k.dendai.ac.jp, nzhou_at_acm.org, ok_at_atlas.otago.ac.nz,
> oskar_at_ifcomputer.co.jp, pmoura_at_di.ubi.pt, pts_at_cs.bme.hu,
> roger.scowen_at_npl.co.uk, spa_at_di.uevora.pt, szeredi_at_cs.bme.hu,
> vitor_at_cos.ufrj.br, warren_at_cs.sunysb.edu
> Subject: Re: Preliminary draft for the revised ISO Prolog core
> standard
>
> On Thursday 16 November 2006 09:30, Bart Demoen wrote:
>>> min/2 and max/2
>>>
>>> For max, the implementation has the choice of returning the
>>> largest argument as is or applying the rules of floating-point
>>> contagion, taking all the arguments into consideration for
>>> contagion purposes.
>>>
>>> So Common Lisp does allow it. At least it doesn't require it.
>>> By experiment, max/2 in SWI Prolog and SICStus Prolog already
>>> behaves
>>> the way this definition requires. I don't like it. I don't
>>> like it
>>> at all, but if it IS the common behaviour, it had better
>>> become the
>>> standard behaviour.
>>
>> I don't like it either.
>> Also, SWI 5.6.12 doesn't - maybe that narrows the Prologs that do it
>> down to SICStus and that could render more discussion on this
>> fruitless. (or did Jan introduce it in newer versions that 5.6.12 ?)
>>
>> One consequence of this floating-point contagion is that in a
>> system with
>>
>> bigints - like SICStus - max/2 can now also throw an overflow
>> exception:
>> | ?- X is 234<<23423, Y is max(X,0.1).
>>
>> ! Evaluation error in argument 2 of is/2
>> ! float_overflow at 2482014388617793184935802414678 [some more digits
>> snipped away by me]
>>
>> SICStus seems happy to evaluate X is 234<<23423 - so the << eval
>> is not the
>> problem.
>
> I'm getting some problems what `it' means, but current SWI-Prolog's
> min/max are *select* functions. They have deliberately been changed to
> this behaviour. "A is max(4<<230000, 2.0)." gived a number I won't
> print
> on this list. Ultimately it does mpz_get_d() and than float
> comparison.
> I see the GMP docs does not say what happens on overflow, but a
> test shows
> it binds to float infinity. So, min/max have no error conditions.
>
> --- Jan

-----------------------------------------------------------------
Paulo Jorge Lopes de Moura
Dep. of Computer Science, University of Beira Interior
6201-001 Covilhã, Portugal

Office 4.3 Ext. 3257
Phone: +351 275319891 Fax: +351 275319899
Email: <mailto:pmoura_at_di.ubi.pt>

Home page: <http://www.di.ubi.pt/~pmoura>
Research: <http://logtalk.org/>
-----------------------------------------------------------------
Received on Mon Jul 14 2008 - 13:01:03 EST

This archive was generated by hypermail 2.2.0 : Wed Sep 08 2010 - 23:28:17 EST