Re: This was memory fragmentation



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
.



Relevant Pages

  • Re: GPS Vs COMPASS
    ... fail to see the "connection" between safety and failing to ... > connect with the environment? ... If you're always safe and cosy you'll only ever connect with anything on ...
    (uk.rec.walking)
  • Re: Best Practices for Organizing CSS?
    ... I am still figuring out the best ways to simplify. ... It's not particularly obvious when a given property or selector is vital and ... The only safe way I know is ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Filter that matches SWEN-virus-emails
    ... It would be safe to simplify all of the Att*-rules into one rule that ... Since there is no registered audio/x-* MIME type it should not match any ... - Veronica Loell ...
    (microsoft.public.security.virus)
  • Re: Very poor Lisp performance
    ... Bang! ... | The only safe way to write expressions in C is to put parentheses | ...
    (comp.lang.lisp)
  • FP and FFP, can this be done both safely at the same time?
    ... I have the feeling that we can do both FP and FFP ... expressions but predicate lambda expressions. ... When we would make it safe, ...
    (comp.lang.prolog)