]> git.proxmox.com Git - rustc.git/blame - vendor/packed_simd/src/api/math/float/ln.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / vendor / packed_simd / src / api / math / float / ln.rs
CommitLineData
f20569fa
XL
1//! Implements vertical (lane-wise) floating-point `ln`.
2
3macro_rules! impl_math_float_ln {
4 ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => {
5 impl $id {
6 /// Returns the natural logarithm of `self`.
7 #[inline]
8 pub fn ln(self) -> Self {
9 use crate::codegen::math::float::ln::Ln;
10 Ln::ln(self)
11 }
12 }
13
14 test_if!{
15 $test_tt:
16 paste::item! {
17 pub mod [<$id _math_ln>] {
18 use super::*;
19 #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
20 fn ln() {
21 let z = $id::splat(0 as $elem_ty);
22 let o = $id::splat(1 as $elem_ty);
23 assert_eq!(z, o.ln());
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!((o - e.ln()).abs().le(tol).all());
28 }
29 }
30 }
31 }
32 };
33}