``````
Jon Gilkison wrote:
>
> Anyone have code to convert degrees to radians? 8)
>
> Jon.Gilkison;

Here's a couple of different approaches; first the cannonical function
definition (converted from an old BASIC math library):

------------------------>8 cut here 8<------------------------
function Deg2Rad( Degrees : extended ) : extended ;
(* convert degress to radians *)
begin
Deg2Rad := ( PI * Degrees ) / 180.0 ;
end (* function Deg2Rad *) ;

(* convert radians to degrees *)
begin
end (* function Rad2Deg *) ;
------------------------>8 cut here 8<------------------------

These are stolen from a Pascal math library I found on the net:

------------------------>8 cut here 8<------------------------
const
ONE_DEG   =  0.017453292519943295769237;   { 1 deg in rads }

function deg_to_rad(x : extended ): extended;
{ convert degrees to radians }
begin
end;

function rad_to_deg(x : extended): extended ;
{ convert radians to degrees }
begin
end;

``````

[Back to DELPHI SWAG index]  [Back to Main SWAG index]  [Original]