Change-Id: I0da3857013f1d4e90820fb043314d78924113a27
GitHub-Last-Rev:
7c3d813c6e188a4afda54b736db14370e52b6f94
GitHub-Pull-Request: golang/go#31019
Reviewed-on: https://go-review.googlesource.com/c/go/+/169078
Reviewed-by: Robert Griesemer <gri@golang.org>
// 3 s+c c-s
var temp float64
- switch n & 3 {
+ switch s, c := Sincos(x); n & 3 {
case 0:
- temp = Cos(x) + Sin(x)
+ temp = c + s
case 1:
- temp = -Cos(x) + Sin(x)
+ temp = -c + s
case 2:
- temp = -Cos(x) - Sin(x)
+ temp = -c - s
case 3:
- temp = Cos(x) - Sin(x)
+ temp = c - s
}
b = (1 / SqrtPi) * temp / Sqrt(x)
} else {
// 3 s+c c-s
var temp float64
- switch n & 3 {
+ switch s, c := Sincos(x); n & 3 {
case 0:
- temp = Sin(x) - Cos(x)
+ temp = s - c
case 1:
- temp = -Sin(x) - Cos(x)
+ temp = -s - c
case 2:
- temp = -Sin(x) + Cos(x)
+ temp = -s + c
case 3:
- temp = Sin(x) + Cos(x)
+ temp = s + c
}
b = (1 / SqrtPi) * temp / Sqrt(x)
} else {