Convert decimal number to rational: Difference between revisions

→‎{{header|PARI/GP}}: how to solve the general problem
(→‎{{header|PARI/GP}}: how to solve the general problem)
Line 513:
floor(x*10^n)/10^n
};</lang>
 
To convert a number into a rational with a denominator not dividing a power of 10, use <code>contfrac</code> and the Gauss-Kuzmin distribution to distinguish (hopefully!) where to truncate.
 
=={{header|Liberty BASIC}}==