Closed EdGaere closed 2 years ago
Arithmetic operator "less-than-or-equal-to" (<=) seems to perform a string comparison rather than a numerical comparison.
I am still a beginner at ProLog/ProbLog. Either way, I thinks it's misleading.
%less than or equal to 12 lte_12(X) :- X @=< 12. query(lte_12(11)) . query(lte_12(12)) . query(lte_12(13)) . query(lte_12(99) ) . query(lte_12(100)) .
Output:
lte_12(11): 1 lte_12(12): 1 lte_12(13): 0 lte_12(99): 0 lte_12(100): 1 <-- ?? lte_12(1000): 1 <-- ??
Python 3.8.3 problog==2.2.2
Solved it. Use intgr(), on both sides, to force a numerical comparison.
lte_12(X) :- intgr(X) @=< intgr(12) .
Arithmetic operator "less-than-or-equal-to" (<=) seems to perform a string comparison rather than a numerical comparison.
I am still a beginner at ProLog/ProbLog. Either way, I thinks it's misleading.
Output:
Python 3.8.3 problog==2.2.2