File tree 3 files changed +45
-0
lines changed
3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "rust-analyzer.checkOnSave.extraArgs" : [
3
+ " +nightly"
4
+ ],
5
+ "rust-analyzer.runnables.cargoExtraArgs" : [
6
+ " +nightly"
7
+ ]
8
+ }
Original file line number Diff line number Diff line change @@ -33,3 +33,5 @@ pub use masks::*;
33
33
34
34
mod vector;
35
35
pub use vector:: * ;
36
+
37
+ mod libmf32;
Original file line number Diff line number Diff line change
1
+ use crate :: SimdF32 ;
2
+
3
+ impl < const LANES : usize > SimdF32 < LANES >
4
+ where
5
+ Self : crate :: LanesAtMost32 ,
6
+ {
7
+ // This does not seem to be implemented, yet.
8
+ #[ inline]
9
+ fn mul_add ( self , mul : Self , add : Self ) -> Self {
10
+ self * mul + add
11
+ }
12
+
13
+ /// Compute the sine of the angle in radians.
14
+ /// Result is accurate to 0.0000002.
15
+ ///
16
+ /// # Example
17
+ ///
18
+ /// ```
19
+ /// use core_simd::SimdF32;
20
+ /// let x = SimdF32::<8>::splat(1.0);
21
+ /// assert!((x.sin() - SimdF32::<8>::splat((1.0_f32).sin())).abs().horizontal_max() < 0.0000002);
22
+ /// ```
23
+ #[ inline]
24
+ pub fn sin ( & self ) -> Self {
25
+ let x = Self :: splat ( 1.0 / ( core:: f32:: consts:: PI * 2.0 ) ) * self ;
26
+ let x = x - x. floor ( ) - 0.5 ;
27
+ Self :: splat ( 12.268859941019306_f32 )
28
+ . mul_add ( x * x, Self :: splat ( -41.216241051002875_f32 ) )
29
+ . mul_add ( x * x, Self :: splat ( 76.58672703334098_f32 ) )
30
+ . mul_add ( x * x, Self :: splat ( -81.59746095374902_f32 ) )
31
+ . mul_add ( x * x, Self :: splat ( 41.34151143437585_f32 ) )
32
+ . mul_add ( x * x, Self :: splat ( -6.283184525811273_f32 ) )
33
+ * x
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments