Different classes of predicate deal with the undecidable cases in different ways:
Figure 9.2: Comparing two bounded reals
?- X = 0.2__0.3, Y = 0.0__0.1, X > Y. X = 0.2__0.3 Y = 0.0__0.1 Yes ?- X = 0.2__0.3, Y = 0.0__0.1, X < Y. No ?- X = 0.0__0.1, Y = 0.0__0.1, X < Y. X = 0.0__0.1 Y = 0.0__0.1 Delayed goals: 0.0__0.1 < 0.0__0.1 Yes ?- X = Y, X = 0.0__0.1, X < Y. No
?- X = 0.2__0.3, Y = 0.0__0.1, X == Y. No ?- X = 0.0__0.1, Y = 0.0__0.1, X == Y. X = 0.0__0.1 Y = 0.0__0.1 Yes ?- X = 0.2__0.3, Y = 0.0__0.1, compare(R, X, Y). R = > X = 0.2__0.3 Y = 0.0__0.1 Yes ?- X = 0.1__3.0, Y = 0.2__0.3, compare(R, X, Y). R = < X = 0.1__3.0 Y = 0.2__0.3 Yes ?- X = 0.0__0.1, Y = 0.0__0.1, compare(R, X, Y). R = = X = 0.0__0.1 Y = 0.0__0.1 Yes ?- sort([-5.0, 1.0__1.0], Sorted). Sorted = [1.0__1.0, -5.0] % 1.0__1.0 > -5.0, but 1.0__1.0 @< -5.0 Yes
( X >= 0 -> % Code A ; % Code B ) |
( not X >= 0 -> % Code B ; % Code A ) |
( not X < 0 -> % Code A ; % Code B ) |