Calculate the PI value to 100 million algorithms

zhaozj2021-02-16  59

I have considered the calculation of the PI value to 100 million algorithms with Delphi, and it is useful to communicate. This is an algorithm for constructing a new long four arithmetic. The so-called long four operations refers to a fraction of a fraction with a field with a field, with a record of a decimal number of algorithms. LONGADD (), longsub (), longmulti (), longdiv (), and then ask for a PI formula. Below I have made longAdd (), I have not been debugged. First, do six global bookmark variables: publicXieof, xpeof, yieof, ypeof, zieof, zpeof: tbookmarkstr; procedure longadd (add1, add2, sum: integer); // field index value. varadd1i, add1p, add2i, add2p, sumi, sump: integer; add1iend, add1pend, add2iend, add2pend, temp, jump: integer; beginadd1i: = add1; add1p: = add1 1; add2i: = add2; add2p: = add2 1; SUMI: = SUM; SUMP: = SUM 1; TEMP: = 0; Jump: = 0; // The index value of the field.

longtable.bookmark: = xpeof; add1pend: = longtable.recno; longtable.bookmark: = ypeof; add2pend: = longtable.recno; if add1pend = add2pend then longtable.bookmark: = XPEOF; While Not Bof () Do Begin // ## IF (longtable.recno add2pend) THEN Beginfields (SUMP): = Fields (add2p); longtable.prior; continue; end; If (longtable.recno add1pend) THEN BEGINFIELDS (SUMP): = Fields (add1p); longtable.prior; continue; end; temp: = fields (add1p) Fields (add2p); if (Jump = 1) THEN BEGIN TEMP: = Temp 1; Jump: = 0; End; IF (Temp> = 10) THEN BegInfields (SUMP): = Temp-10; Jump: = 1; End; IF Temp <10 THEN FIELDS (SUMP): = Temp; Longtable.Prior; end; // ## While not longtable.recno> max (add1iend, add2iend) Do begin @@iff (longtable.recno> min (add1iend, add2iend)) and (add1iend min (add1iend, add2iend)) and (add1iend> add2iend) then beginfields (sumi) : = Fields (Add1i) Longtable.next; Continue; End; Temp: = fields (add1i) Fields (add2i); if (jump = 1) Tens: = Temp 1; Jump: = 0; End; IF (Temp> = 10 ......................................................................... ..

转载请注明原文地址:https://www.9cbs.com/read-24531.html

New Post(0)