SmartPascal
Cos
Function
The Cosine of a number System unit
 function Cos ( const Number : Extended ) : Extended;
Description
The Cos function is a mathematical function giving the Cosine value of a Number value given radians.
 
PI radians  = 180 degrees
Notes
The System unit supports only the following angular functions:

ArcTan
Sin
Cos

Related commands
ArcCos The Arc Cosine of a number, returned in radians
ArcSin The Arc Sine of a number, returned in radians
ArcTan The Arc Tangent of a number, returned in radians
Sin The Sine of a number
Tan The Tangent of a number
 
Example code : Get the Cosine of 60 degrees
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  // The System unit does not need to be defined
  SysUtils,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  float : single;
begin
  // The Sine of 60 degrees = 0.5
  float := Cos(PI/3);   // = 180/3 = 60 degrees
  ShowMessage('Cos(PI/3) = '+FloatToStr(float));
end;
 
end.
Hide full unit code
   Cos(PI/3) = 0.5