From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,PDS_BTC_ID autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a7135c0f450945a5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news3.google.com!feeder.news-service.com!news.mixmin.net!aioe.org!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: How to convert a string containing two hex digits to a character? Date: Fri, 15 Jan 2010 17:06:32 -0500 Organization: The Wasteland Message-ID: References: <93bb3b0f-1140-4fb7-8d7e-d97af3b57aaa@m16g2000yqc.googlegroups.com> <74e3d1de-b560-442d-8190-f3285ee31b0c@f5g2000yqh.googlegroups.com> <2m4g35mnk59z$.xhxh0f7riqad.dlg@40tude.net> <1a68twjk8xoel.16vicep9cbrn2.dlg@40tude.net> <1eb0d4a1-8ad0-442a-b9aa-2b41a3f3a8db@d20g2000yqh.googlegroups.com> <95653745-d21d-4cf9-8604-315ff185021a@j5g2000yqm.googlegroups.com> NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.1 Cancel-Lock: sha1:oeW0iPv8+QncP+dVmt09CigSByM= User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news1.google.com comp.lang.ada:8771 Date: 2010-01-15T17:06:32-05:00 List-Id: In article <95653745-d21d-4cf9-8604-315ff185021a@j5g2000yqm.googlegroups.com>, Hibou57 (Yannick DuchĂȘne) wrote: > Found here : http://docs.python.org/library/stdtypes.html > > Funny to apply this on Pi :P Well, I had to try it: >>> float.as_integer_ratio(math.pi); (884279719003555L, 281474976710656L) It's not as good as my favorite, due to Arima Yoriyuki: $ cat pi.bc #!/usr/bin/bc -lq scale = 30 print "python: ",884279719003555/281474976710656,"\n" print "Arima: ",428224593349304/136308121570117,"\n" print "4*a(1): ",4*a(1),"\n" print "Wiki: 3.141592653589793238462643383279\n" quit $ ./pi.bc python: 3.141592653589793115997963468544 Arima: 3.141592653589793238462643383275 4*a(1): 3.141592653589793238462643383276 Wiki: 3.141592653589793238462643383279 -- John B. Matthews trashgod at gmail dot com