Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: e with continued fractions

by tachyon (Chancellor)
on Jul 18, 2004 at 05:05 UTC ( [id://375331]=note: print w/replies, xml ) Need Help??


in reply to e with continued fractions

Diabolical. You can make the ASCII quite pretty too:

;;$|++;use=> bigint;my($a,$b,$c,$d ,$m,$n) =(0,1,1 ,0,0,0) ;while (){if( $b&&$d &&(my$ e=int( $a/$b))==int($c/$d)){$a=10*($a-$b*$ e);$c=10*($c-$d*$e);print$e;}else{$ e=$a;$ a=$c;$ c=$c*( ($m%3) %2?$n* 2:1) +$e;$e=$ b;$b=$ d;$d=$d*(($m++%3)%2?$n++ *2:1)+$e;}};#e

cheers

tachyon

Replies are listed 'Best First'.
Re^2: e with continued fractions
by jdalbec (Deacon) on Jul 22, 2004 at 03:29 UTC

    On Perl 5.8.1 (Mac OS X 10.3.4) this doesn't seem to use bigint (as you apparently intended) unless I remove the =>.

    Update: OK, you fooled me. Good obfuscation, then!

      I use 5.6.x so don't actually have bigint. This is called obfuscation after all :-) The reason it does not work is that => is just a synonym for , in Perl so it reads use, bigint Or it should. Actually that , syntax parses as an error, whereas => syntax is OK GOK?

      C:\>type test.pl use, strict C:\>perl -MO=Deparse test.pl syntax error at test.pl line 1, near "use," test.pl had compilation errors. C:\>type test.pl use => strict C:\>perl -MO=Deparse test.pl '???', '???'; test.pl syntax OK C:\>

      cheers

      tachyon

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://375331]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-29 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found