:- use_module(library(clpBNR)).
clpBNR_default_precision
); otherwise fails. This is done by splitting any intervals in round robin order of their widths until all domains are smaller than the required limit. Splitting can only be done at points not in the solution space (unlike splitsolve/1
); this avoids the splitting a single solution range into multiple solutions (although this can still occur for other reasons). Other solutions can be generated on backtracking. Examples:
?- X::real, {17*X**256+35*X**17-99*X==0}, solve(X). X:: 0.0000000000000000... ; X:: 1.005027892894011... . ?- [X,Y]::real, {X+Y==1,X-Y==1}, solve([X,Y]). X:: 1.0000000000000..., Y::real(-4.96269692007445e-14, 4.96269692007445e-14).
The two main use cases for solve/1
are a) to separate multiple solutions in a within domain (or set of domains), and b) to overcome the well known dependancy issue when using interval arithmetic. (In clpfd
terminology, solve/1
is a labelling predicate.)