degToRad (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

3.10 / 1.00.00


This function converts an angle from degrees to radians.

 

Note: This function works with DOUBLE, but can also work with FLOAT as described in the Floating-point math introductory section.

 

Input:

v : DOUBLE

Angle to convert in degrees.

 

Returns: DOUBLE

The value of the angle in radians.

 

Declaration:

FUNCTION degtoRad : DOUBLE;
VAR_INPUT
v : DOUBLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
INCLUDE math.inc
 
PROGRAM test;
 
DebugMsg(message := " sin(270) = " + doubleToStr(v := sin(v := degToRad(v := 270.0))));
DebugMsg(message := " asin(1) = " + doubleToStr(v := radToDeg(v := asin(v := 1.0))));
 
END_PROGRAM;