[hackers] Re: x86-64 support

Jason Andresen jandrese at mitre.org
Wed Apr 30 07:26:09 PDT 2003


Terry Lambert wrote:
> Harti Brandt wrote:
> DG>501859265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
> 
>>DG>
>>DG>... and so on for many digits.  Neither matches:
>>DG>
>>DG>echo "scale=200; 4*a(1)" | bc -l
>>DG>3.141592653589793238462643383279502884197169399375105820974944592307\
>>DG>81640628620899862803482534211706798214808651328230664709384460955058\
>>DG>223172535940812848111745028410270193852110555964462294895493038196
>>
>>If you look careful only the first four digits don't match.
> 
> 
> You mean the four most significant digits, right?  8-) 8-) 8-).

Strange though, it worked for me (although I did clean up the code a 
touch to see exactly what it did before I ran it):

#include <stdio.h>

int main()
{
         int f[91800],b,c=9814,g,i;
         long a=1e4,d,e,h;
         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;
}

% ./pi
31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959
092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326
459958133904780275900994657640789512694683983525957098258226205224894077267194782684826014769909026401363944374553050682034962524517493996514314298091906592509372216964615157098583874105978859597729754989301617539284681382686838689427741559918559252459539594310499725246808459872736446958486538367362226260991246080512438843904512441365497627807977156914359977001296160894416948685558484063534220722258284886481584560285060168427394522674676788952521385225499546667278239864565961163548862305774564980355936345681743241125150760694794510965960940252288797108931456691368672287489405601015033086179286809208747609178249385890097149096759852613655497818931297848216829989487226588048575640142704775551323796414515237462343645428584447952658678

I made f bigger than I needed to, but it was only on a hunch with the 
original code (which dumped core).

-- 
   \  |_ _|__ __|_ \ __| Jason Andresen        jandrese at mitre.org
  |\/ |  |    |    / _|  Network and Distributed Systems Engineer
_|  _|___|  _| _|_\___| Office: 703-883-7755




More information about the freebsd-hackers mailing list