Search code examples
integerprologiso-prolog

What are the minimum/maximum integers in gprolog?


What are the minimum/maximum integers in gprolog? Is there a way to reference these numbers without using a "magic number"?


Solution

  • I think these should work:

    current_prolog_flag(bounded, X).
    current_prolog_flag(min_integer, Y).
    current_prolog_flag(max_integer, Z).
    

    bounded tells you whether your implementation supports arbitrary large integers; if it's false, the min_integer / max_integer calls will fail.