On Thu, September 21, 2006 9:32 pm, Curt Zirzow wrote:
> On 9/21/06, Tom Atkinson <[EMAIL PROTECTED]> 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.

We're probably talking about that silly contest started the other day
to calculate pi to 1000 digits...

:-)

My best guess is that the C code is relying on type-casting to hack
something somewhere.

-- 
Like Music?
http://l-i-e.com/artists.htm



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

Reply via email to