Bill Allombert on Thu, 04 Jun 2009 22:01:22 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Is There a Way to Rationalize a Decimal in Pari/GP? |
On Thu, Jun 04, 2009 at 09:47:48AM -0400, Rick Regan wrote: > I'm looking for an automated way to turn a decimal value into a > fraction in the PARI/GP calculator (gp). For example, I want to turn > 0.759765625 into 389/512. I know I can do this manually by typing in > '759765625/10^9', but I'd like an easier way, like > 'rationalize(0.759765625);' would work in Maxima. Please use bestappr or contfrac: ? bestappr(0.759765625,10^9) %1 = 389/512 ? contfracpnqn(contfrac(0.759765625)) %2 = [389 136] [512 179] Cheers, Bill.