Source File
sin.go
Belonging Package
math
package math
var _sin = [...]float64{
1.58962301576546568060e-10, // 0x3de5d8fd1fd19ccd
-2.50507477628578072866e-8, // 0xbe5ae5e5a9291f5d
2.75573136213857245213e-6, // 0x3ec71de3567d48a1
-1.98412698295895385996e-4, // 0xbf2a01a019bfdf03
8.33333333332211858878e-3, // 0x3f8111111110f7d0
-1.66666666666666307295e-1, // 0xbfc5555555555548
}
var _cos = [...]float64{
-1.13585365213876817300e-11, // 0xbda8fa49a0861a9b
2.08757008419747316778e-9, // 0x3e21ee9d7b4e3f05
-2.75573141792967388112e-7, // 0xbe927e4f7eac4bc6
2.48015872888517045348e-5, // 0x3efa01a019c844f5
-1.38888888888730564116e-3, // 0xbf56c16c16c14f91
4.16666666666665929218e-2, // 0x3fa555555555554b
}
:= false
= Abs()
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 {
++
++
}
&= 7 // octant modulo 2Pi radians (360 degrees)
= (( - *) - *) - * // Extended precision modular arithmetic
}
if > 3 {
-= 4
= !
}
if > 1 {
= !
}
:= *
if == 1 || == 2 {
= + **((((((_sin[0]*)+_sin[1])*+_sin[2])*+_sin[3])*+_sin[4])*+_sin[5])
} else {
= 1.0 - 0.5* + **((((((_cos[0]*)+_cos[1])*+_cos[2])*+_cos[3])*+_cos[4])*+_cos[5])
}
if {
= -
}
return
}
:= 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 {
++
++
}
&= 7 // octant modulo 2Pi radians (360 degrees)
= (( - *) - *) - * // Extended precision modular arithmetic
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin 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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |