File tree 1 file changed +10
-10
lines changed 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -103,15 +103,15 @@ func Jn(n int, x float64) float64 {
103
103
// 3 s+c c-s
104
104
105
105
var temp float64
106
- switch n & 3 {
106
+ switch s , c := Sincos ( x ); n & 3 {
107
107
case 0 :
108
- temp = Cos ( x ) + Sin ( x )
108
+ temp = c + s
109
109
case 1 :
110
- temp = - Cos ( x ) + Sin ( x )
110
+ temp = - c + s
111
111
case 2 :
112
- temp = - Cos ( x ) - Sin ( x )
112
+ temp = - c - s
113
113
case 3 :
114
- temp = Cos ( x ) - Sin ( x )
114
+ temp = c - s
115
115
}
116
116
b = (1 / SqrtPi ) * temp / Sqrt (x )
117
117
} else {
@@ -278,15 +278,15 @@ func Yn(n int, x float64) float64 {
278
278
// 3 s+c c-s
279
279
280
280
var temp float64
281
- switch n & 3 {
281
+ switch s , c := Sincos ( x ); n & 3 {
282
282
case 0 :
283
- temp = Sin ( x ) - Cos ( x )
283
+ temp = s - c
284
284
case 1 :
285
- temp = - Sin ( x ) - Cos ( x )
285
+ temp = - s - c
286
286
case 2 :
287
- temp = - Sin ( x ) + Cos ( x )
287
+ temp = - s + c
288
288
case 3 :
289
- temp = Sin ( x ) + Cos ( x )
289
+ temp = s + c
290
290
}
291
291
b = (1 / SqrtPi ) * temp / Sqrt (x )
292
292
} else {
You can’t perform that action at this time.
0 commit comments