Just to illustrate the origin of the problem: my code above stays in a file named three_cubes.pl. Then
Welcome to SWI-Prolog (threaded, 64 bits, version 8.5.17)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- edit(three_cubes).
true.
ok so far, the next ERROR is expected…
?- p(X,Y,Z).
ERROR: Unknown procedure: p/3 (DWIM could not correct goal)
so, switch to the editor window, and compile what is inside: I’m used to Ctrl-C Ctrl-B… then go back to the REPL, where ?- p(X,Y,Z).
causes the error.
?-
% *** clpBNR v0.10.1 ***.
?- p(X,Y,Z).
ERROR: Arithmetic: evaluation error: `float_overflow'
ERROR: In:
ERROR: [22] clpBNR:lower_bound_val_(real,-1.0Inf,_4132)
ERROR: [21] clpBNR:int_decl_(real,(-1.0Inf,1.0Inf),_4166) at c:/users/carlo/appdata/local/swi-prolog/pack/clpbnr/prolog/clpbnr.pl:430
ERROR: [18] clpBNR:build_args_([_4214,...|...],[_4226|_4228],[real,real|...],_4244/_4246,_4210) at c:/users/carlo/appdata/local/swi-prolog/pack/clpbnr/prolog/clpbnr.pl:638
ERROR: [17] clpBNR:build_(_4294**3+_4300**3,_4278,real,_4306/_4308,_4284) at c:/users/carlo/appdata/local/swi-prolog/pack/clpbnr/prolog/clpbnr.pl:633
ERROR: [16] clpBNR:build_args_([... + ...,...],[_4368|_4370],[real,real],_4386/_4388,_4346) at c:/users/carlo/appdata/local/swi-prolog/pack/clpbnr/prolog/clpbnr.pl:638
ERROR: [14] clpBNR:build_(... + ... == ... + -9,1,boolean,_4448/_4450,_4426) at c:/users/carlo/appdata/local/swi-prolog/pack/clpbnr/prolog/clpbnr.pl:633
ERROR: [13] clpBNR:buildConstraint_(... + ... == ... + -9,_4506/_4508,_4484) at c:/users/carlo/appdata/local/swi-prolog/pack/clpbnr/prolog/clpbnr.pl:594
ERROR: [11] clpBNR:{... + 9==_4554**3} at c:/users/carlo/appdata/local/swi-prolog/pack/clpbnr/prolog/clpbnr.pl:561
ERROR: [10] three_cubes:p(_4586,_4588,_4590) at c:/users/carlo/documents/prolog/three_cubes.pl:10
ERROR: [9] toplevel_call(user:user: ...) at c:/program files/swipl/boot/toplevel.pl:1169
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
Exception: (13) clpBNR:buildConstraint_(_1202{integer(0,239)}**3+_1124{integer(0,239)}**3==_1280{integer(0,239)}**3+ -9, _1350/_1350, _1354) ?
As we have seens, it goes away following the appropriate interface (?- use_module(...).
)