[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: x86-64 support
From:       Peter Jeremy <peterjeremy () optushome ! com ! au>
Date:       2003-05-27 9:20:06
[Download RAW message or body]

On Tue, May 27, 2003 at 09:56:58AM +0100, Doug Rabson wrote:
>On Monday 28 April 2003 1:54 am, Oliver Fromme wrote:
>> You don't need that; the digits of pi can be calculated
>> quite easily with integer math.  This snippet is from my
>> signature collection:
>>
>> int f[9800],b,c=9814,g,i;long
>> a=1e4,d,e,h;main(){for(;b=c,c-=14;i=printf(
>> "%04d",e+d/a),e=d%a)while(g=--b*2)d=h*b+a*(i?f[b]:a/5),h=d/--g,f[b]=d
>>%g;}
>>
>> Of course it doesn't comply with style(9), otherwise it
>> wouldn't fit into two lines.  Prettifying (de-obfuscating)
>> it to make it style(9)-compliant is left as an exercise to
>> the reader.  ;-)
>
>Doesn't appear to work. When I run this, it prints '1877' followed by 
>lots of zeros...

A followup pointed out that there is an error in the size of 'f': it
should be f[9814] (matching c).  With this change, the result looks
reasonably close to pi.

Peter
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic