C++ Math asin()

The function computes the inverse sine of a number given in radian.

asin(x) = sin-1x

Syntax

Suppose a number is 'x'. Syntax would be:

Note: If the value passed is an integer type, then it is cast to double.

Parameter

x: The value whose inverse sine is to be calculated

Return value

ParameterReturn value
-1≤x≤1-∏/2,∏/2
x<-1 or x>1Not a Number

Example 1

Let's see a simple example when the value of x is zero.

Output:

Value of Sine is :0
Inverse of Sine is :0   

In this example, asin() function calculates the inverse sine of a number when the value of x is zero.

Example 2

Let's see a simple example when the value of x is greater than 1.

Output:

Value of Sine is :1
Inverse of Sine is :nan   

In this example, asin() function calculates the inverse sine of a number when the value of x is greater than 1.

Example 3

Let's see a simple example when the value of x is less than -1.

Output:

Value of Sine is : -0.978004
Inverse of Sine is :nan   

In this example, asin() function calculates the inverse sine of a number when the value of x is less than -1.






Latest Courses