@@ -211,30 +211,29 @@ public static TVectorSingle CosSingle<TVectorSingle, TVectorInt32, TVectorDouble
211
211
const int ARG_SMALLER = 0x39000000 ; // 2^-27
212
212
213
213
TVectorSingle ax = TVectorSingle . Abs ( x ) ;
214
- TVectorInt32 ux = Unsafe . BitCast < TVectorSingle , TVectorInt32 > ( x ) ;
214
+ TVectorInt32 ux = Unsafe . BitCast < TVectorSingle , TVectorInt32 > ( ax ) ;
215
215
216
216
TVectorSingle result ;
217
217
218
- if ( TVectorSingle . LessThanOrEqualAll ( ax , TVectorSingle . Create ( ARG_LARGE ) ) )
218
+ if ( TVectorInt32 . LessThanOrEqualAll ( ux , TVectorInt32 . Create ( ARG_LARGE ) ) )
219
219
{
220
220
// We must be a finite value: (pi / 4) >= |x|
221
221
222
222
if ( TVectorInt32 . GreaterThanAny ( ux , TVectorInt32 . Create ( ARG_SMALL - 1 ) ) )
223
223
{
224
224
// at least one element is: |x| >= 2^-13
225
- TVectorSingle x2 = x * x ;
226
225
227
226
if ( TVectorSingle . Count == TVectorDouble . Count )
228
227
{
229
228
result = Narrow < TVectorDouble , TVectorSingle > (
230
- CosSingleSmall ( Widen < TVectorSingle , TVectorDouble > ( x2 ) )
229
+ CosSingleSmall ( Widen < TVectorSingle , TVectorDouble > ( x ) )
231
230
) ;
232
231
}
233
232
else
234
233
{
235
234
result = Narrow < TVectorDouble , TVectorSingle > (
236
- CosSingleSmall ( WidenLower < TVectorSingle , TVectorDouble > ( x2 ) ) ,
237
- CosSingleSmall ( WidenUpper < TVectorSingle , TVectorDouble > ( x2 ) )
235
+ CosSingleSmall ( WidenLower < TVectorSingle , TVectorDouble > ( x ) ) ,
236
+ CosSingleSmall ( WidenUpper < TVectorSingle , TVectorDouble > ( x ) )
238
237
) ;
239
238
}
240
239
}
@@ -1838,11 +1837,11 @@ public static (TVectorSingle Sin, TVectorSingle Cos) SinCosSingle<TVectorSingle,
1838
1837
const int ARG_SMALLER = 0x39000000 ; // 2^-27
1839
1838
1840
1839
TVectorSingle ax = TVectorSingle . Abs ( x ) ;
1841
- TVectorInt32 ux = Unsafe . BitCast < TVectorSingle , TVectorInt32 > ( x ) ;
1840
+ TVectorInt32 ux = Unsafe . BitCast < TVectorSingle , TVectorInt32 > ( ax ) ;
1842
1841
1843
1842
TVectorSingle sinResult , cosResult ;
1844
1843
1845
- if ( TVectorSingle . LessThanOrEqualAll ( ax , TVectorSingle . Create ( ARG_LARGE ) ) )
1844
+ if ( TVectorInt32 . LessThanOrEqualAll ( ax , TVectorInt32 . Create ( ARG_LARGE ) ) )
1846
1845
{
1847
1846
// We must be a finite value: (pi / 4) >= |x|
1848
1847
@@ -2183,11 +2182,11 @@ public static TVectorSingle SinSingle<TVectorSingle, TVectorInt32, TVectorDouble
2183
2182
const int ARG_SMALLER = 0x39000000 ; // 2^-27
2184
2183
2185
2184
TVectorSingle ax = TVectorSingle . Abs ( x ) ;
2186
- TVectorInt32 ux = Unsafe . BitCast < TVectorSingle , TVectorInt32 > ( x ) ;
2185
+ TVectorInt32 ux = Unsafe . BitCast < TVectorSingle , TVectorInt32 > ( ax ) ;
2187
2186
2188
2187
TVectorSingle result ;
2189
2188
2190
- if ( TVectorSingle . LessThanOrEqualAll ( ax , TVectorSingle . Create ( ARG_LARGE ) ) )
2189
+ if ( TVectorInt32 . LessThanOrEqualAll ( ax , TVectorInt32 . Create ( ARG_LARGE ) ) )
2191
2190
{
2192
2191
// We must be a finite value: (pi / 4) >= |x|
2193
2192
0 commit comments