Rick Regan on Thu, 04 Jun 2009 21:43:57 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Is There a Way to Rationalize a Decimal in Pari/GP?
|
- To: pari-users@list.cr.yp.to
- Subject: Is There a Way to Rationalize a Decimal in Pari/GP?
- From: Rick Regan <exploringbinary@gmail.com>
- Date: Thu, 4 Jun 2009 09:47:48 -0400
- Delivery-date: Thu, 04 Jun 2009 21:43:57 +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=27drFoNgkukcZG2zo1b2OrQDDx/eGTxfxZN51d9wcqI=; b=mHMm4kClCate0lzOU0doz+msbgBPmgZcy4YUU1UOto9On9u+soQES0a1E37um25xsz QCEvJ327RBB+Kq/yh1/Wbd7tHo2+QbTjHI9O3VC2MOdyMpsbseF/65/qWr3ME5NyBPVd ebKEY3tGZb4cXqbxdlu6ReEjxVBfVGdOspoZY=
- 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=o/1FwlYuGYK+V3PtmpVN8wFSQIZUhE9K40/L9L8LH/YqzhpGGE3B36i8vgJ9jU0THd 4EJzWpHzEf9tFc/UlqERnP17Mrjj1QmHqeT1+sMJoV15VNx69GgfTej0k97glNKOUMgO zXWanAZ0mT21z5IG8XtYuWT6hFPKgBlOeDqlM=
- Mailing-list: contact pari-users-help@list.cr.yp.to; run by ezmlm
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.
If it can't do this directly, maybe there's a function to count the
number of decimal places? Then I could raise 10 to the result of that
function. (The function would have to count leading decimal places of
0s to be useful.)
Thanks.
Rick Regan
--
“There are 10 types of people ... those who understand binary and
those who don't” -- http://www.exploringbinary.com