RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.Pi Function

Returns 3.1415926535897932385.

Pascal
function Pi: Extended;
C++
Extended Pi();

System

Use Pi in Delphi code to represent the mathematical value pi, the ratio of a circle's circumference to its diameter. Pi is approximated as 3.1415926535897932385.  

Delphi Examples: 

 

{
This example shows how to use the ArcTan and FloatToStr
functions.
}
procedure TForm1.Button1Click(Sender: TObject);
var
  ex : Extended;
  mystring : String;
begin
  ex := 16 * ArcTan(1/5) - 4 * ArcTan(1/239); // Machin's formula
  mystring := FloatToStr(ex);
  Edit2.Text := mystring;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  ex : Extended;
  myString : String;
begin
  ex := Pi;
  mystring := FloatToStr(ex);
  Edit1.Text := mystring;
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!