The asin()
function, also called the arc sine
function, returns the inverse sine of a number. To be more specific, it returns the inverse sine of a number in radians.
Figure 1 shows the mathematical representation of the asin()
function.
Note:
dart:math
is required for this function.
To convert radians to degrees, use the following formula:
degrees = radians * ( 180.0 / pi )
double asin(double num)
This function requires a number as a parameter. The parameter must be a double value between -1 and 1.
-1 \leq parameter \leq 1.
If the value is outside -1 \leq parameter \leq 1, then it returns NaN.
asin()
returns the inverse sine of a number in radians that is sent as a parameter. The return value lies in the interval [-\pi/2, \pi/2] radians.
import 'dart:convert';import 'dart:math';void main() {//positive number in radiansprint("The value of asin(0.5): ${asin(0.5)} Radians");// negative number in radiansprint("The value of asin(-0.5): ${asin(-0.5)} Radians");//applying asin() and then converting the result in radians to degrees// radians = 0.5// PI = 3.14159265double result=asin(0.5) * (180.0 / pi);print("The value of asin(0.5): ${result} Degrees");//error outputprint("The value of asin(1.5): ${asin(1.5)} ");print("The value of asin(-1.5): ${asin(-1.5)} ");}