SmartPascal
DegToRad
Function
Convert a degrees value to radians Math unit
 function DegToRad ( const Degrees : Extended ) : Extended;
Description
The DegToRad function is a mathematical function converting a Degrees value to Radians
 
PI radians = 180 degrees
Related commands
CelsiusToFahrenheit Convert a celsius temperature into fahrenheit
Convert Convert one measurement value to another
FahrenheitToCelsius Convert a fahrenheit temperature into celsius
RadToDeg Converts a radian value to degrees
 
Example code : Get the Sine of 30 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
  Math,   // Unit containing the DegToRad command
  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 30 degrees = 0.5
  float := Sin(DegToRad(30));
  ShowMessage('Sine off 30 degrees = '+FloatToStr(float));
end;
 
end.
Hide full unit code
   Sine of 30 degrees = 0.5