| 
	Rick Regan on Fri, 05 Jun 2009 15:15:56 +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: pari-users@list.cr.yp.to
 
- Subject: Re: Is There a Way to Rationalize a Decimal in Pari/GP?
 
- From: Rick Regan <exploringbinary@gmail.com>
 
- Date: Thu, 4 Jun 2009 21:00:32 -0400
 
- Delivery-date: Fri, 05 Jun 2009 15:15:56 +0200
 
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=gamma;        h=domainkey-signature:mime-version:received:date:message-id:subject         :from:to:content-type:content-transfer-encoding;        bh=GDMnIYUrQjxnXnHZwlQHHNrzstciCzs8yftJ4enj0Ws=;        b=L+gKdwfgOVtNr3Inqui6emyazz8PEr5dMuP9TYeM5ydrQXlbQf87Yqn4FUI+/ZHFkn         nQufkuoCEGgFaFFijr/VP/h4lpz/iLrVvs4YXgnLP7QN/HaiH3Z74XGGw4bum0WbnLBx         I+/0NmmHCFFIhqxy439mdaiuLift8AbBC0b7U=
 
- Domainkey-signature: a=rsa-sha1; c=nofws;        d=gmail.com; s=gamma;        h=mime-version:date:message-id:subject:from:to:content-type         :content-transfer-encoding;        b=JJ/9Jqyu3HeIf6uCQCmPtftYBb0XkzAKeaFRJQjY8rYGsocGdQ0WTsFc/BOtsZEDuL         lJtVUlp7gxzHNHHAXSjc1CRtZQiHV4Ys5hHHHq6oNIhndJrNfpQKIej694KDldQmprYi         X25+4XO5Pta9RsNcu+Bft4RpKFnGcyPd+DR8M=
 
- Mailing-list: contact pari-users-help@list.cr.yp.to; run by ezmlm
 
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