John Cremona on Fri, 05 Jun 2009 15:42:34 +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?


It was not supposed to be off list ;)

bestappr() uses continued fractions, and cannot do better than the
precision you give it, so it is not very clear what the "exact
fraction" is (unless you specify the decimal expansion in such detail
that the full period is seen!)

John

2009/6/5 Rick Regan <exploringbinary@gmail.com>:
> Thanks Bill (and John who contacted me off list). -- bestappr() does the trick!
>
> In my case I always want the exact fraction, so I have to make sure I
> specify a large enough denominator. I am converting long decimals, and
> I don't want to count decimal places. The easy solution seems to be to
> pass bestappr() an arbitrarily large power of 10, like
> bestappr(0.1000000000000000055511151231257827021181583404541015626,10^100).
>
> Rick
>
> --
> “There are 10 types of people ... those who understand binary and
> those who don't” -- http://www.exploringbinary.com
>