Re: [prolog-standard] Re: log10/1, log/2, min/2, and max/2

From: Jonathan Hodgson <jhodgson_at_sju.edu>
Date: Mon, 20 Nov 2006 14:56:36 -0500

I have a problem with some of this discussion of max/2. If max is an
arithmetic operation then max(2, 2.0) should probably give 2.0 --
although people who mix types deserve what they get.

Jonathan

Paulo Moura wrote:
>
> On 2006/11/16, at 19:39, Jan Wielemaker wrote:
>
>> On Thursday 16 November 2006 19:37, Paulo Moura wrote:
>>>> Why is this desirable, when it leads to the problems indicated?
>>>> After all, this is an arithmetic function, so there is no reason
>>>> why it should not use the same floating-point contagion rule
>>>> like all other symmetric binary operations,
>>>
>>> Agree.
>>
>> First of all, in practice min and max are rarely used with mixed types.
>
> If that's true then...
>
>> Second, most implementations providing unbounded integer arithmetic do
>> not provide unbounded floats, so max(2<<10000, 2.0)
>
> ... this example is meaningless as it uses mixed types, correct? :-)
>
>> raises an error if
>> we promote the floats. Before that you may loose acuracy in the
>> unnecessary promotion to float. Select semantics avoids all these
>> problems.
>
> Cheers,
>
> Paulo
>
>
> -----------------------------------------------------------------
> 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/>
> -----------------------------------------------------------------
>
>
>
>
> _______________________________________________
> prolog-standard mailing list
> prolog-standard_at_neve.di.ubi.pt
> http://neve.di.ubi.pt/mailman/listinfo/prolog-standard

_______________________________________________
prolog-standard mailing list
prolog-standard_at_neve.di.ubi.pt
http://neve.di.ubi.pt/mailman/listinfo/prolog-standard
Received on Mon Jul 14 2008 - 13:01:04 EST

This archive was generated by hypermail 2.2.0 : Wed Sep 08 2010 - 23:36:42 EST