The documentation of mathematical functions, and the declarations of operators is inconsistent and confusing.
mod is documented with +IntExpr1 mod +IntExpr2, and current_op(_,_,mod) is true. gcd is documented with +IntExpr1 gcd +IntExpr2, but current_op(_,_,gcd) is false. div is documented with div(+IntExpr1, +IntExpr2), yet current_op(_,_,div) is true.
It occurred to me that gcd not being an operator might have something to do with the fact that it’s not an ISO function. However
rdiv is not ISO, is documented with +IntExpr1 gcd +IntExpr2, and current_op(_,_,rdiv) is true.
There is no relation between arithmetic functions and Prolog operators. E.g., ISO sin(Angle) is also not an operator. There is current_arithmetic_function/1 to test whether something is evaluable by is/2, =:=/2, etc. Unfortunately that is not a standard predicate
rdiv is from the days that SWI-Prolog did not have rational numbers as first class citizens. It should not have been an operator, but deleting it will probably make (too) many people unhappy because they still have legacy code from before the days that SWI-Prolog supports rational numbers properly.
Agree. SWI-Prolog’s section on arithmetic does not talk about operators at all though. It always refers to them as functions (or arithmetic functions).