Re: Help converting C to PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/21/06, Tom Atkinson <nibbler@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Hello,

I am attempting to convert this code for generating the digits of pi
from the original C (below) to PHP.

  long k=4e3,p,a[337],q,t=1e3;
   main(j){for(;a[j=q=0]+=2,--k;)
   for(p=1+2*k;j<337;q=a[j]*k+q%p*t,a[j++]=q/p)
   k!=j>2?:printf("%.3d",a[j-2]%t+q/p/t);}


wow this is rather bad. it would probably be better to write this in
asm, it would be easier to read than the way it is in C.


I converted this to a more readable form:

what about using:
 php.net/pi

note the precision description.

or are we talking about a different pi.


Curt.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux