title: Integer square root works in SWI-Prolog and YAP, but but not in GNU-Prolog
body: <p>I tested the following code by adding it to the user file in swipl, gprolog, and yap:</p>
  
  <pre><code>isqrt(N, _) :-
      N &lt; 0, !, fail. 
  isqrt(N, N) :-
      N &lt; 2.
  isqrt(N, R) :-
      X is N,
      Y is (N // 2),
      isqrt(N, X, Y, R).
  
  isqrt(_, X, Y, X) :- 
      Y &gt;= X.
  isqrt(N, _, Y, R) :-
      Z is ((Y + N // Y) // 2),
      isqrt(N, Y, Z, R).
  </code></pre>
  
  <p>This works as expected in swipl and yap, but in gprolog I get the following error message for N > 1:</p>
  
  <pre><code>uncaught exception: error(existence_error(procedure,isqrt/0),isqrt/0)
  </code></pre>
  
  <p>This is strange to me because none of the predicates in my code rely on <code>isqrt/0</code>. Could this be a bug in GNU-Prolog? What can I do to as a workaround?</p>
  
  <hr/>
  
  <p>Edit: Here's exactly what I do to produce this error in gprolog on ubuntu:</p>
  
  <pre><code>$ gprolog
  GNU Prolog 1.4.5 (64 bits)
  Compiled Feb  5 2017, 10:30:08 with gcc
  By Daniel Diaz
  Copyright (C) 1999-2016 Daniel Diaz
  | ?- [user].
  compiling user for byte code...
  isqrt(N, _) :-
      N &lt; 0, !, fail. 
  
  isqrt(N, N) :-
      N &lt; 2.
  
  isqrt(N, R) :-
      X is N,
      Y is (N // 2),
      isqrt(N, X, Y, R).
  
  isqrt(_, X, Y, X) :- 
      Y &gt;= X.
  
  isqrt(N, _, Y, R) :-
      Z is ((Y + N // Y) // 2),
      isqrt(N, Y, Z, R).
  
  user compiled, 17 lines read - 1656 bytes written, 10751 ms
  
  yes
  | ?- isqrt(100, X).
  uncaught exception: error(existence_error(procedure,isqrt/0),isqrt/0)
  </code></pre>