|Did you know ...||Search Documentation:|
trueor one of the arguments is a float, both arguments are converted to float and the return value is a float. Otherwise the result type depends on the Prolog flag prefer_rationals. If
true, the result is always a rational number. If
falsethe result is rational if at least one of the arguments is rational. Otherwise (both arguments are integer) the result is integer if the division is exact and float otherwise. See also section 220.127.116.11, ///2, and rdiv/2.
The current default for the Prolog flag prefer_rationals
false. Future version may switch this to
providing precise results when possible. The pitfall is that in general
rational arithmetic is slower and can become very slow and produce huge
numbers that require a lot of (global stack) memory. Code for which the
exact results provided by rational numbers is not needed should force
float results by making one of the operants float, for example by
10.0 rather than
10 or by using float/1.
Note that when one of the arguments is forced to a float the division is
a float operation while if the result is forced to the float the
division is done using rational arithmetic.