]>
git.proxmox.com Git - rustc.git/blob - vendor/packed_simd_2/src/api/math/float/sin.rs
1 //! Implements vertical (lane-wise) floating-point `sin`.
3 macro_rules
! impl_math_float_sin
{
4 ([$elem_ty
:ident
; $elem_count
:expr
]: $id
:ident
| $test_tt
:tt
) => {
8 pub fn sin(self) -> Self {
9 use crate::codegen
::math
::float
::sin
::Sin
;
13 /// Sine of `self * PI`.
15 pub fn sin_pi(self) -> Self {
16 use crate::codegen
::math
::float
::sin_pi
::SinPi
;
20 /// Sine and cosine of `self * PI`.
22 pub fn sin_cos_pi(self) -> (Self, Self) {
23 use crate::codegen
::math
::float
::sin_cos_pi
::SinCosPi
;
24 SinCosPi
::sin_cos_pi(self)
31 pub mod [<$id _math_sin
>] {
33 #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
35 use crate::$elem_ty
::consts
::PI
;
36 let z
= $id
::splat(0 as $elem_ty
);
37 let p
= $id
::splat(PI
as $elem_ty
);
38 let ph
= $id
::splat(PI
as $elem_ty
/ 2.);
39 let o_r
= $id
::splat((PI
as $elem_ty
/ 2.).sin());
40 let z_r
= $id
::splat((PI
as $elem_ty
).sin());
42 assert_eq
!(z
, z
.sin());
43 assert_eq
!(o_r
, ph
.sin());
44 assert_eq
!(z_r
, p
.sin());