// Copyright 2010 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

// Coefficients _sin[] and _cos[] are found in pkg/math/sin.go.

// Sincos returns Sin(x), Cos(x).
//
// Special cases are:
//
//	Sincos(±0) = ±0, 1
//	Sincos(±Inf) = NaN, NaN
//	Sincos(NaN) = NaN, NaN
func ( float64) (,  float64) {
	const (
		 = 7.85398125648498535156e-1  // 0x3fe921fb40000000, Pi/4 split into three parts
		 = 3.77489470793079817668e-8  // 0x3e64442d00000000,
		 = 2.69515142907905952645e-15 // 0x3ce8469898cc5170,
	)
	// special cases
	switch {
	case  == 0:
		return , 1 // return ±0.0, 1.0
	case IsNaN() || IsInf(, 0):
		return NaN(), NaN()
	}

	// make argument positive
	,  := false, false
	if  < 0 {
		 = -
		 = true
	}

	var  uint64
	var ,  float64
	if  >= reduceThreshold {
		,  = trigReduce()
	} else {
		 = uint64( * (4 / Pi)) // integer part of x/(Pi/4), as integer for tests on the phase angle
		 = float64()           // integer part of x/(Pi/4), as float

		if &1 == 1 { // map zeros to origin
			++
			++
		}
		 &= 7                               // octant modulo 2Pi radians (360 degrees)
		 = (( - *) - *) - * // Extended precision modular arithmetic
	}
	if  > 3 { // reflect in x axis
		 -= 4
		,  = !, !
	}
	if  > 1 {
		 = !
	}

	 :=  * 
	 = 1.0 - 0.5* + **((((((_cos[0]*)+_cos[1])*+_cos[2])*+_cos[3])*+_cos[4])*+_cos[5])
	 =  + **((((((_sin[0]*)+_sin[1])*+_sin[2])*+_sin[3])*+_sin[4])*+_sin[5])
	if  == 1 ||  == 2 {
		,  = , 
	}
	if  {
		 = -
	}
	if  {
		 = -
	}
	return
}