Sign in Join
Wiki copytemporary

Pi/de: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-\
21π ist das Verhältnis des Umfangs eines Kreises zu seinem Durchmesser.\
32Der Wert von π ist in etwa 3,14159265358979.\
43Der Umfang eines Kreises wird enweder mit\
54U = π (2 * r)\
65oder mit\
76U = π * d\
87berechnet.\
9-\
8+
109In Pascal ist pi eine Funktion, die den Wert von π zurückgibt.\
11-\
10+
1211π/4 ist das gleiche wie arctan(1).\
13-\
12+
1413Sämtliche Trigonometrische Funktionen (sin, cos, etc.) werden mit FPC im Bogenmass berechnet. Dies entspricht 360° = 2 * Pi.\
15-\
16-\
14+
1715Olaf 20:06, 20 November 2016 (CET)
1816
1917## Pi hoch aufgelöst
2018
2119Will man **Pi** sehr genau ausrechnen, kann man sich mit folgender Procedure behelfen.
2220
2321``` pascal
2422program Project1;
2523
2624uses
2725 Crt;
2826
2927var
3028 stellen: integer;
3129
3230 procedure CalcPi;
3331 var
3432 r, p: string;
3533 m, i, j, u, z: integer;
3634
3735 c: array of integer;
3836 begin
3937 SetLength(c, 10 * (Stellen + 1) div 3 + 1);
4038 r := '';
4139 p := '';
4240 m := 10 * (Stellen + 1) div 3;
4341 for i := 1 to m do begin
4442 c[i] := 2;
4543 end;
4644 for j := 0 to Stellen do begin
4745 if j mod 100 = 0 then begin
4846 GotoXY(1, 1);
4947 WriteLn('Stelle: ', j);
5048 end;
5149
5250 u := 0;
5351 for i := m downto 2 do begin
5452 z := 10 * c[i] + u;
5553 c[i] := z mod (i * 2 - 1);
5654 u := z div (i * 2 - 1) * (i - 1);
5755 end;
5856 z := 10 * c[1] + u;
5957 c[1] := z mod 10;
6058 u := z div 10;
6159 if u <= 8 then begin
6260 r := r + p;
6361 p := Chr(48 + u);
6462 end;
6563 if u = 9 then begin
6664 p := p + Chr(48 + u);
6765 end;
6866 if u = 10 then begin
6967 for i := 1 to Length(p) do begin
7068 Val(p[i], z, u);
7169 Inc(z);
7270 if z = 10 then begin
7371 z := 0;
7472 end;
7573 p[i] := Chr(48 + z);
7674 end;
7775 p := p + '0';
7876 end;
7977 end;
8078 p := r[1] + '.' + Copy(r, 2, Length(r)) + p;
8179 WriteLn(p);
8280 SetLength(c, 0);
8381 end;
8482
8583begin
8684 ClrScr;
8785 Writeln('Bitte Stellen eingeben: ');
8886 readln(stellen);
8987 CalcPi;
9088end.
9189```
9290
9391---
9492*From the Free Pascal wiki, page "Pi/de", as it stood on 2018-02-11 after a change by Mathias, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
9593Category: Pascal/de

Back to history