Skip to content

Commit b15503c

Browse files
committed
Refactor to fit current testing strategy.
1 parent 1cbf555 commit b15503c

File tree

4 files changed

+22
-36
lines changed

4 files changed

+22
-36
lines changed

crates/core_simd/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@ pub use masks::*;
3737
mod vector;
3838
pub use vector::*;
3939

40-
mod libmf32;
4140
mod array;
4241
pub use array::SimdArray;

crates/core_simd/src/libmf32.rs

-35
This file was deleted.

crates/core_simd/src/vector/float.rs

+14
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ macro_rules! impl_float_vector {
6262
Self::splat(1.0) / self
6363
}
6464

65+
/// Calculate the sine of the angle
66+
#[inline]
67+
pub fn sin(self) -> Self {
68+
let x = Self::splat(1.0 / (3.14159265358 * 2.0)) * self;
69+
let x = x - x.floor() - 0.5;
70+
Self::splat(12.268859941019306)
71+
.mul_add(x * x, Self::splat(-41.216241051002875))
72+
.mul_add(x * x, Self::splat(76.58672703334098))
73+
.mul_add(x * x, Self::splat(-81.59746095374902))
74+
.mul_add(x * x, Self::splat(41.34151143437585))
75+
.mul_add(x * x, Self::splat(-6.283184525811273))
76+
* x
77+
}
78+
6579
/// Converts each lane from radians to degrees.
6680
#[inline]
6781
pub fn to_degrees(self) -> Self {

crates/core_simd/tests/ops_macros.rs

+8
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,14 @@ macro_rules! impl_float_tests {
459459
)
460460
}
461461

462+
fn sin<const LANES: usize>() {
463+
test_helpers::test_unary_elementwise(
464+
&Vector::<LANES>::sin,
465+
&Scalar::sin,
466+
&|_| true,
467+
)
468+
}
469+
462470
fn to_degrees<const LANES: usize>() {
463471
test_helpers::test_unary_elementwise(
464472
&Vector::<LANES>::to_degrees,

0 commit comments

Comments
 (0)