asin (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

3.10 / 1.00.00


This function will calculate the arc sine of an angle.

 

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

 

Input:

V : DOUBLE (-1 .. +1)

Value to compute the arc sine of.

 

Returns: DOUBLE

The arc sine of the angle in radians. If V is invalid, NaN is returned.

 

Declaration:

FUNCTION asin : DOUBLE;
VAR_INPUT
v : DOUBLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
INCLUDE math.inc
 
PROGRAM test;
VAR
  a : DOUBLE;
END_VAR;
 
a := cos(v:=0.4);
DebugMsg(message:=" cos " + doubleToStr(v := a));
DebugMsg(message:="acos " + doubleToStr(v := acos(v:=a)));
a := sin(v:=0.4);
DebugMsg(message:=" sin " + doubleToStr(v := a));
DebugMsg(message:="asin " + doubleToStr(v := asin(v:=a)));
a := tan(v:=0.4);
DebugMsg(message:=" tan " + doubleToStr(v := a));
DebugMsg(message:="atan " + doubleToStr(v := atan(v:=a)));
a := atan2(a:=10.0, b:= 10.0);
DebugMsg(message:="atan2 " + doubleToStr(v := a));
 
// Output:
//  cos 0.9210609916817709
// acos 0.4000000059604644
//  sin 0.3894183477986018
// asin 0.4000000059604644
//  tan 0.4227932257640837
// atan 0.4000000059604645
// atan2 0.7853981633974483
 
END_PROGRAM;