Asin()
Published Sep 6, 2023
Contribute to Docs
The Asin()
function returns the inverse sine of a number.
Syntax
result := math.Asin(number)
The Asin()
function takes one parameter, number
, a type of float64
, which must be within the range of -1
and 1
(inclusive).
The Asin()
function returns a number, the inverse sine (also known as arcsine) value of number
as a float64
. This returned value represents an angle in radians whose sine equals the number
. If the value of number
is:
- Zero (
0
), then it returns0
- Less than
-1
, then it returnsNAN
(Not a Number) - Greater than
1
, then it returnsNAN
Note: The
math
library must be imported first to use this function.
Example
The following example first calculates the inverse sine of num
and then prints out the result to the console:
package mainimport ("fmt""math")func main() {num := 0.9inverseSine := math.Asin(num)fmt.Printf("The inverse sine of %f is %f\n", num, inverseSine)}
The output will be:
The inverse sine of 0.900000 is 1.119770
Codebyte Example
The following example is runnable and uses the Asin()
function with two values: 1.1
and 0.0
.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.