Re: This was memory fragmentation
- From: vscosta@xxxxxxxxx
- Date: Thu, 7 Feb 2008 02:39:59 -0800 (PST)
On Feb 7, 8:45 am, Bart Demoen <b...@xxxxxxxxxxxxxxxxx> wrote:
Joachim Schimpf wrote:
a(N,_) :- ( N> 0 -> .. ; ... ).
Don't forget that N > 0 and N =< 0 may both fail with ieee floats.
So to be safe you'd need some analysis too.
Both failing is not a big problem, just make the if-then-else into
a(N,_) :- ( N> 0 -> .. ; N =< 0, ... ).
which og course would be wrong if both can succeed :-(
Cheers
Bart Demoen
This is getting interesting.
If we observe that the constant 0 is an integer, then we may avoid the
problem by using:
a(N,_) :- ( integer(N) -> (N> 0 -> ... ; ... ) ; original_code ).
or, in case we want to accept expressions that evaluate to an integer:
a(N,_) :- ( evaluates_to_integer(N,N1) -> (N1 > 0 -> ... ; ... ) ;
original_code ).
This would allow to further simplify the code for N1>0, as no type-
checking would now be required.
But I am sure Bart will find something wrong with this :) Or he is
doing this already :)
Cheers
Vitor
Cheers
Vitor
.
- References:
- This was memory fragmentation
- From: A . L .
- Re: This was memory fragmentation
- From: bart demoen
- Re: This was memory fragmentation
- From: vscosta
- Re: This was memory fragmentation
- From: Joachim Schimpf
- Re: This was memory fragmentation
- From: Bart Demoen
- This was memory fragmentation
- Prev by Date: Re: This was memory fragmentation
- Next by Date: Re: This was memory fragmentation
- Previous by thread: Re: This was memory fragmentation
- Next by thread: Re: This was memory fragmentation
- Index(es):
Relevant Pages
|