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?
|
- To: Rick Regan <exploringbinary@gmail.com>
- Subject: Re: Is There a Way to Rationalize a Decimal in Pari/GP?
- From: John Cremona <john.cremona@gmail.com>
- Date: Fri, 5 Jun 2009 14:40:51 +0100
- Cc: pari-users@list.cr.yp.to
- Delivery-date: Fri, 05 Jun 2009 15:42:34 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=XHwS+j6wF73UwA9J0/PSdqH7pfaX2aKVCNwtG3SnJlo=; b=jrsRKVYHfsPJwZpZTv0U63WiXIhaOYnK+6m85M9f9fVyFUTq5pOvUDggTFhkGP6mgx tTEBa3LMRoH3wxgEEBF7yCNroBQo+MOFCSFakvuYKCPDbE9CLK383WvNgjtnszC9kgPZ M+BJL3wu7k5BcOxT4iDAx6IVbx8C/h8BgozBg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=XHLUefGFH0MNtUEZAPlayhS3UaQwUkNLOe0a5WT9OoeQw6wyG8Jbb11rzGUkNSKtIH BgOdbAN4yr0Po6jcmpM36UtzuNUQPWSbowPrAHUfCFgOFq3QYwebsau74WsOw7bnfMkO Vxox+55szmIKxChkN132pHmB54p7pVmYiTNe4=
- In-reply-to: <88670b420906041800i3d469553t575917727c12c16e@mail.gmail.com>
- Mailing-list: contact pari-users-help@list.cr.yp.to; run by ezmlm
- References: <88670b420906041800i3d469553t575917727c12c16e@mail.gmail.com>
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
>