DelphiBasics
Pi
Function
The mathematical constant System unit
 function Pi : Extended;
Description
The Pi function returns a floating point value giving a useful approximation of the value of Pi.
 
The circumference of a circle Pi * Diameter.
Related commands
Cos The Cosine of a number
Extended The floating point type with the highest capacity and precision
Sin The Sine of a number
Tan The Tangent of a number
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Get the area and circumference of a circle
var
  myPi : Extended;
  diam : Integer;
begin
  diam := 10;

  // Show circumference and the area of a circle
  // with diameter - 10 cm
  ShowMessage('     Diameter = '+IntToStr(diam));
  ShowMessage('Circumference = '+FloatToStr(Pi*diam));
  ShowMessage('         Area = '+FloatToStr(Pi*(diam/2)*(diam/2)));
end;
Show full unit code
        Diameter = 10
   Circumference = 31.4159265358979
            Area = 78.5398163397448
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page