login

Availability:Arithmetic function (see is/2)
rationalize(+Expr)
Convert the Expr to a rational number or integer. The function is similar to rational/1, but the result is only accurate within the rounding error of floating point numbers, generally producing a much smaller denominator.78The names rational/1 and rationalize/1 as well as their semantics are inspired by Common Lisp.
?- A is rationalize(0.25).

A = 1 rdiv 4
?- A is rationalize(0.1).

A = 1 rdiv 10