|
|||
Скачать Huge - Precision Calculation with 40000 Digits
18.08.1997 The two units used should come after this message. Uncomment several write- commands to get a "fully" operational program rather than this benchmark version. You then also can skip the Timer unit and the two commands from that unit (TimerOn and TimerOff) to make the program much smaller (no float math linked into the program). program PiCalc; { The fastest PI calculator you'll ever find... :) } { From bits and pieces picked up mainly from the FidoNet PASCAL echo } { Collected, optimized, unitized, etc. by Bjorn Felten @ 2:203:208 } { Public Domain -- Nov 1994 } { Units needed are at the end !! } uses HugeUtil, Timer; { use Crt if you want fast printout on screen } { don't if you want to be able to redirekt o/p } var words, number : longint; nin, link, pii, a239 : HugePtr; procedure ArcCoTan(n : integer; var angle : Huge); var n2, del, remain : integer; positive : boolean; begin { corresp. integer operations } ZeroHuge(angle,words); { angle := 0 } ZeroHuge(nin^,words); { nin := 0 } ZeroHuge(link^,words); { link := 0 } angle.dat[angle.len] := 1; { angle := 1 } DivHuge(angle,n,angle,remain); { angle := angle div n } n2 := n*n; { n2 := n * n } del := 1; { del := 1 } positive := true; CopyHuge(angle,nin^); { nin := angle } repeat DivHuge(nin^,n2,nin^,remain); { nin := nin div n2 } inc(del, 2); { del := del + 2 } positive := not positive; DivHuge(nin^,del,link^,remain);{ link := nin div del } if positive then AddHuge(angle,link^) { angle := angle + link } else SubHuge(angle,link^); { angle := angle - link } { uncomment to see that program is not dead } { write(#13,word(del)) } until (link^.len <= 1) and (link^.dat[1] = 0); { wr | |||
© 2009–2023 Russian Pascal Developer Network.
Техническая площадка: ISBIZ Хостинг |