1 //! Implements vertical (lane-wise) floating-point `exp`.
2 
3 macro_rules! impl_math_float_exp {
4     ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => {
5         impl $id {
6             /// Returns the exponential function of `self`: `e^(self)`.
7             #[inline]
8             pub fn exp(self) -> Self {
9                 use crate::codegen::math::float::exp::Exp;
10                 Exp::exp(self)
11             }
12         }
13 
14         test_if!{
15             $test_tt:
16             paste::item! {
17                 pub mod [<$id _math_exp>] {
18                     use super::*;
19                     #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
20                     fn exp() {
21                         let z = $id::splat(0 as $elem_ty);
22                         let o = $id::splat(1 as $elem_ty);
23                         assert_eq!(o, z.exp());
24 
25                         let e = $id::splat(crate::f64::consts::E as $elem_ty);
26                         let tol = $id::splat(2.4e-4 as $elem_ty);
27                         assert!((e - o.exp()).abs().le(tol).all());
28                     }
29                 }
30             }
31         }
32     };
33 }
34