Jekejeke Prolog 1.4.3 (Rational Numbers)
Jan Burse, created Apr 09. 2020, modified Apr 10. 2020
We just uploaded a new release of Jekejeke Prolog. The following major improvements are provided:
- Module "bits":
Evaluable functions from the minlog extension were moved to the runtime library and given SWI-Prolog compatible names. The number theoretic functions gcd/2 and lcm/2 are now preloaded, so are the bitwise functions msb/1, lsb/1 and popcount/1.
- New module "ratio":
This module provides rational number arithmetic. Sorting of rational numbers has not yet been implemented. Otherwise we provide the SWI-Prolog/ECLiPSe Prolog functionality plus some extra functionality like gcd/2, mod/2, etc.. extended to rational numbers. Rational number results are displayed with the operator (#)/2:
?- X is gcd(21 rdiv 10, 35 rdiv 6).
X = 7#30
- New module "approx":
This module provides approximation of float and float32 numbers by rational numbers. Very large or very small numbers cannot yet be converted back. Otherwise the approximation is more space-saving than in SWI-Prolog/ECLiPSe Prolog.
?- X is rationalize((93+pi)/103).
X = 77876443#83431878
The new features of the modules "ratio" and "approx" are still in experimental stage and should receive further improvements in the upcoming releases.
Happy coding! #StayHome