In C++, the asin() function is defined in the <cmath> or <math.h> header file and is used to calculate the inverse sine (arc sine) of a given value. The inverse sine of a number is the angle whose sine is equal to that number, and the returned angle is expressed in radians.
The input value for the asin() function must be within the range -1 to 1. If the value is outside this range, the function returns NaN (Not a Number). The asin() function is widely used in trigonometry, geometry, graphics programming, and scientific calculations.
It has the following syntax:
x: The value whose inverse sine is to be calculated
| Parameter | Return value |
|---|---|
| -1≤x≤1 | -∏/2,∏/2 |
| x<-1 or x>1 | Not a Number |
Here, we are going to discuss several examples to demonstrate the Math asin() Function
This example demonstrates how to calculate the inverse sine when the input value is zero using the asin() function.
Output:
Value of Sine is :0 Inverse of Sine is :0
Explanation:
In this example, asin() function calculates the inverse sine of a number when the value of x is zero.
This example demonstrates how the asin() function behaves when the input value is greater than 1. Since the value is outside the valid range, the function returns NaN.
Output:
Value of Sine is :1 Inverse of Sine is :nan
Explanation:
In this example, asin() function calculates the inverse sine of a number when the value of x is greater than 1.
This example demonstrates how the asin() function behaves when the input value is outside the valid range less than -1. In such cases, the function returns NaN.
Output:
Value of Sine is : -0.978004 Inverse of Sine is :nan
Explanation:
In this example, asin() function calculates the inverse sine of a number when the value of x is less than -1.
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India