File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,20 @@ macro_rules! impl_float_vector {
45
45
Self :: splat( 1.0 ) / self
46
46
}
47
47
48
+ /// Calculate the sine of the angle
49
+ #[ inline]
50
+ pub fn sin( self ) -> Self {
51
+ let x = Self :: splat( 1.0 / ( 3.14159265358 * 2.0 ) ) * self ;
52
+ let x = x - x. floor( ) - 0.5 ;
53
+ Self :: splat( 12.268859941019306 )
54
+ . mul_add( x * x, Self :: splat( -41.216241051002875 ) )
55
+ . mul_add( x * x, Self :: splat( 76.58672703334098 ) )
56
+ . mul_add( x * x, Self :: splat( -81.59746095374902 ) )
57
+ . mul_add( x * x, Self :: splat( 41.34151143437585 ) )
58
+ . mul_add( x * x, Self :: splat( -6.283184525811273 ) )
59
+ * x
60
+ }
61
+
48
62
/// Converts each lane from radians to degrees.
49
63
#[ inline]
50
64
#[ must_use = "method returns a new vector and does not mutate the original value" ]
Original file line number Diff line number Diff line change @@ -397,6 +397,14 @@ macro_rules! impl_float_tests {
397
397
)
398
398
}
399
399
400
+ fn sin<const LANES : usize >( ) {
401
+ test_helpers:: test_unary_elementwise(
402
+ & Vector :: <LANES >:: sin,
403
+ & Scalar :: sin,
404
+ & |_| true ,
405
+ )
406
+ }
407
+
400
408
fn to_degrees<const LANES : usize >( ) {
401
409
test_helpers:: test_unary_elementwise(
402
410
& Vector :: <LANES >:: to_degrees,
You can’t perform that action at this time.
0 commit comments