comp.lang.ada
 help / color / mirror / Atom feed
From: "John B. Matthews" <nospam@nospam.invalid>
Subject: Re: How to convert a string containing two hex digits to a character?
Date: Fri, 15 Jan 2010 17:06:32 -0500
Date: 2010-01-15T17:06:32-05:00	[thread overview]
Message-ID: <nospam-637F41.17063115012010@news.aioe.org> (raw)
In-Reply-To: 95653745-d21d-4cf9-8604-315ff185021a@j5g2000yqm.googlegroups.com

In article 
<95653745-d21d-4cf9-8604-315ff185021a@j5g2000yqm.googlegroups.com>,
 Hibou57 (Yannick Duchêne) <yannick_duchene@yahoo.fr> 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:

<http://en.wikipedia.org/wiki/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
<http://sites.google.com/site/drjohnbmatthews>



  reply	other threads:[~2010-01-15 22:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-06  0:39 How to convert a string containing two hex digits to a character? Leslie
2010-01-06  0:43 ` Leslie
2010-01-06  1:22   ` Hibou57 (Yannick Duchêne)
2010-01-06  1:31     ` Hibou57 (Yannick Duchêne)
2010-01-06  2:05       ` Leslie
2010-01-06  2:39     ` Leslie
2010-01-06  2:42       ` Leslie
2010-01-06 21:54     ` Maciej Sobczak
2010-01-06 22:19       ` Hibou57 (Yannick Duchêne)
2010-01-09 10:50         ` Hibou57 (Yannick Duchêne)
2010-01-09 11:13           ` Hibou57 (Yannick Duchêne)
2010-01-09 11:33             ` Dmitry A. Kazakov
2010-01-09 14:50               ` Hibou57 (Yannick Duchêne)
2010-01-09 16:04                 ` Dmitry A. Kazakov
2010-01-11 15:53                   ` Adam Beneschan
2010-01-11 18:13                     ` Dmitry A. Kazakov
2010-01-15 19:59                     ` Hibou57 (Yannick Duchêne)
2010-01-15 22:06                       ` John B. Matthews [this message]
2010-01-06  5:17 ` tmoran
2010-01-06 22:19   ` Leslie
2010-01-06 22:22   ` Hibou57 (Yannick Duchêne)
2010-01-07 14:26 ` John B. Matthews
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox