Discussion » Calculating Pi In Perl

This is a read-only copy. The forum ran on iamcal.com from 2000 until its database was lost in 2016, and this topic was rebuilt from copies saved by the Internet Archive's Wayback Machine. Some replies may be missing.
Posted by cal, 15:15, 16th June 2003:
 
3.1415926535897932384626433832795028841971640759202962033702571164854676107
075587578699137123672314593922044607030674380872171391483055703198787028995
667011189780862872902868401414350845233049518307193460903821723897812576988
705584330156029174852456823608923884669249616169508072138499360199079075114
947345343681835057511318761888873077090598991163374670730558839619145601467
563513436092579864702457010473153091041632055648861970679249512695997248571
867558359501715350810657714287666308527806458486614976793795246424366418055
774961914249376693378303475883883020138324644903928081149824229542160068266
015082575346896220080100228475847928579508824065562784570571647957159592193
168877568669323758869478780580046588678498315828648426458186644557669794734
368063018275591746967700474701903416587126035852403467918832215234227243900
971921561189259472583371363243542065885271083382701619323236715884999503428
085336259340002218687483184709580761212316083088652556850195844407525622608
01693105684767795526176

www.iamcal.com/files/cal_pi.txt

taken from this C++ code here:
www.cygnus-software.com/misc/pidigits.ht...
Posted by beargod, 15:28, 16th June 2003:
 
I think that is enough decimal places cal, I don't think anyone needs to be that accurate
Posted by cal, 15:36, 16th June 2003:
 
[15:32:36] cal: www.iamcal.com/files/cal_pi2.txt
[15:32:44] cal: this one prints out a value after each iteration
[15:33:33] cal: the formula is pi = (atan(5) * 4 - atan(239)) * 4
[15:33:46] cal: and we use an iterative formula for atan
[15:33:57] cal: so each iteration it gets closer to the true value
[15:34:32] cal: if you run that script
[15:34:42] cal: then you see the value getting more and more accurate
Posted by beargod, 15:41, 16th June 2003:
 
cal are you learning how to be a lecturer? or are you planning on writing a book on PHP? cos that is very very tutor sounding of you
Posted by jeffld, 16:13, 16th June 2003:
 
hehe

my $Result = Math::BigFloat->bone();
Posted by cal, 16:25, 16th June 2003:
 
beargod: perl not php

jeffld: meaning big_one, which makes it even funnier i guess :)
Posted by beargod, 16:28, 16th June 2003:
 
crap yeah damn, sorry cal, are you writing a book in Perl?
Posted by cal, 16:49, 16th June 2003:
 
no, fraid not. not clever enough for that sort of thing
Posted by Saltation, 21:09, 12th August 2004:
 
can't you write a program to do it for you?
Posted by Saltation, 21:10, 12th August 2004:
 
you could write it in VB to piss off the perl heads

"*grumble* my bloody perl book was written in vb, o the shame"
Posted by Sul, 22:07, 12th August 2004:
 
Hahaha, that'd be great! An AI perl expert written in VB. I bet somegeek would get the code and put it into a 5k contest in a day though.
Posted by Saltation, 22:41, 12th August 2004:
 
"this code is written in vb and its output is itself in perl"

$s='$s=%c%s%c;printf($s,39,$s,39);';printf($s,39,$s,39);
Posted by Saltation, 22:43, 12th August 2004:
 
i find this frankly amazing:

E='E=%s;printf "$E" "\x27$E\x27"';printf "$E" "'$E'"
Posted by Saltation, 22:44, 12th August 2004:
 
my all-time favourite ultra-tense code everer:

int a[1817];main(z,p,q,r){for(p=80;q+p-80;p-=2*a[p])for(z=9;z--;)q=3&(r=time(0)
+r*57)/7,q=q?q-1?q-2?1-p%79?-1:0:p%79-77?1:0:p158?-79:0,q?!a[p+q*2
]?a[p+=a[p+=q]=q]=q:0:0;for(;q++-1817;)printf(q%79?"%c":"%c\n"," #"[!a[q-1]]);}
- Author Unknown

draws a valid maze in vt100
nb: 3 x 80char lines
Posted by jeffld, 22:47, 12th August 2004:
 
where is the vb code? I don't see any vb code there.
Posted by Saltation, 10:32, 13th August 2004:
 
i lied, it's not vb. oddly, i couldn't immediately find any examples on the wireless web of people using VB to write Perl.

there is SO a gap in the market there baby
Posted by Brock, 16:05, 14th August 2004:
 
Bash is wise. Bash is good:

#39620 +(191)- [X]

* Takeshi doesn't get the obsession with all the digits of pi
(rabid_si) It's like Mersienne Primes.
(rabid_si) Mathematicians get off on big numbers.
(Takeshi) Oh, so it's mathsturbation?
Posted by Sul, 16:16, 14th August 2004:
 
Amazingly good pun.