// 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()
}