Re: [eclipse-clp-users] How to override arithmetic functions with ISO standard conforming definitions?

From: Paulo Moura <pmoura_at_...342...>
Date: Thu, 8 Nov 2012 12:22:13 +0000
Hi Kish,

On 08/11/2012, at 04:23, Kish Shen <kisshen_at_...5...> wrote:

> Hi Paulo,
> 
> truncate/1 and round/1 occurring inside expressions (i.e. rhs of is/2) are mapped to the corresponding predicates, i.e. they are factored out of the expression and a call to the predicate is made. I would therefore expect that you don't need to do anything different for handling these the same way as you handle the predicate calls -- are you getting different results for the two cases?

On further digging, seems to be a know bug. Looking into the "iso.pl" file I found the following comment:

%-----------------------------------------------------------------------
% 9. Evaluable functors (incomplete)
% Note: the redefinitions of floor,ceiling,round,truncate don't work currently,
% the arithmetic transformation in the ECLiPSe compiler always uses the
% sepia_kernel definitions for the predefined arithmetic functions!
%-----------------------------------------------------------------------

Thus, it doesn't sound as something that I can workaround on my side.

Cheers,

Paulo


> On 06/11/2012 15:13, Paulo Moura wrote:
>> 
>> Hi,
>> 
>> I'm running some portable code and getting into trouble with ECLiPSe (6.1#125) due to the non-standard conforming definitions of arithmetic functions such as truncate/1 and round/1, which return a float instead of an integer, as per the ISO Prolog standard specification.
>> 
>> Is it possible to override the native definitions of these functions? I can only find ways of doing it for predicates, not for functions.
>> 
>> Cheers,
>> 
>> Paulo
>> 
>> 
>> -----------------------------------------------------------------
>> Paulo Moura
>> Logtalk developer
>> 
>> Email: <mailto:pmoura_at_...342...>
>> Web:   <http://logtalk.org/>
>> -----------------------------------------------------------------
>> 
>> 
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> LogMeIn Central: Instant, anywhere, Remote PC access and management.
>> Stay in control, update software, and manage PCs from one command center
>> Diagnose problems and improve visibility into emerging IT issues
>> Automate, monitor and manage. Do more in less time with Central
>> http://p.sf.net/sfu/logmein12331_d2d
>> _______________________________________________
>> ECLiPSe-CLP-Users mailing list
>> ECLiPSe-CLP-Users_at_lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>> 
> 

-----------------------------------------------------------------
Paulo Moura
Logtalk developer

Email: <mailto:pmoura_at_...342...>
Web:   <http://logtalk.org/>
-----------------------------------------------------------------
Received on Thu Nov 08 2012 - 12:22:27 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST