The title of this thread correctly suggests a discrepancy, whether
you like it or not. Your subjective taste in certain matters will
not eradicate this small discrepancy, which is an objective fact.
You say this because you didn’t get my point that (rdiv)/2 is the equivalent of (/)/2,
only for rational numbers and not for floating point numbers. And that therefore
we could apply Joachim Schimpfs list to it. Obviously (rdiv)/2 is mathematically correct
realization of the real number / : R x R \ {0} → R, only the subset Q x Q \ {0}.
I didn’t go into Q* per se, when asking about {0}. But I read from Joachim
Schimpfs that 0 rdiv 0
could be NaN. Similar like 0.0/0.0
could be NaN.
You also blamed Joachim Schimpfs table. This is also FUD, what is your proof
exactly? I don’t think SWI-Prolog flags, as adopted from Joachim Schimpfs
table, have any defect for the ordinary (/)/2. Lets try this:
/* SWI-Prolog 9.1.2 default flags, windows 10 platform */
?- X is 0.0/0.0.
ERROR: Arithmetic: evaluation error: `undefined'
?- set_prolog_flag(float_undefined, nan).
true.
?- X is 0.0/0.0.
X = 1.5NaN.
The above works fine, Joachim Schimpfs table is enough to
get NaN. How can I archive the same for 0 rdiv 0
? Its currently
not possible since the rational arithmetic maps this to zero division
instead to undefined.
Edit 21.01.2023
Maybe I didn’t have this analysis at hand in my previous posts. But
there is now more evidence, that 0 rdiv 0
is not viewed as giving
undefined in SWI-Prolog whereas 0.0/0.0
is viewed as giving undefined,
another case not covered by ISO core standard, and listed by
Joachim Schimpf as an amendment that should be submitted
to the ISO core standard. You can try, when you start SWI-Prolog fresh,
you get with the default flags:
/* SWI-Prolog 9.1.2 default flags, windows 10 platform */
/* Two different errors */
?- catch(X is 0.0/0.0, error(E,_), true).
E = evaluation_error(undefined).
?- catch(X is 1.0/0.0, error(E,_), true).
E = evaluation_error(zero_divisor).
Two different errors as suggested by Joachim Schimpf. On the
other hand (rdiv)/2 doesn’t do the same, it only gives one error:
/* SWI-Prolog 9.1.2 default flags, windows 10 platform */
/* Twice the same error */
?- catch(X is 0 rdiv 0, error(E,_), true).
E = evaluation_error(zero_divisor).
?- catch(X is 1 rdiv 0, error(E,_), true).
E = evaluation_error(zero_divisor).
Hope I could clarify my point, its not some FUD, but a serious question!