Source File
asin.go
Belonging Package
math
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package math
/*
Floating-point arcsine and arccosine.
They are implemented by computing the arctangent
after appropriate range reduction.
*/
// Asin returns the arcsine, in radians, of x.
//
// Special cases are:
//
// Asin(±0) = ±0
// Asin(x) = NaN if x < -1 or x > 1
func ( float64) float64 {
if haveArchAsin {
return archAsin()
}
return asin()
}
func asin( float64) float64 {
if == 0 {
return // special case
}
:= false
if < 0 {
= -
= true
}
if > 1 {
return NaN() // special case
}
:= Sqrt(1 - *)
if > 0.7 {
= Pi/2 - satan(/)
} else {
= satan( / )
}
if {
= -
}
return
}
// Acos returns the arccosine, in radians, of x.
//
// Special case is:
//
// Acos(x) = NaN if x < -1 or x > 1
func ( float64) float64 {
if haveArchAcos {
return archAcos()
}
return acos()
}
func acos( float64) float64 {
return Pi/2 - Asin()
}
The pages are generated with Golds v0.7.0-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |