Result is rational(Number)which should be preferred.
When Number is an integer, Result is a rational with denominator 1.
When Number is already a rational, Result is identical to Number.
When Number is a float, Result is a rational whose value is exactly equal to the value of the floating-point number. Since floats are usually approximations of the intended value, the results may look unintuitive and have unnecessarily large numerators and denominators. Use rationalize/2 to produce the most compact rational that still converts back into the original float. rational/2 is usually faster than rationalize/2.
Bounded reals cannot be converted to rationals.
In coroutining mode, if Number is uninstantiated, the call to rational/2 is delayed until this variable is instantiated.
Success: Result is rational(25). % gives Result = 25_1 Result is rational(1.5). % gives Result = 3_2 Result is rational(3_4). % gives Result = 3_4 Result is rational(9_12). % gives Result = 3_4 Result is rational(-6). % gives Result = -6_1 Result is rational(0.1). % gives Result = 3602879701896397_36028797018963968 Error: Result is rational(0.9__1.1, X). % unimplemented