We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3044080 commit 1c53bffCopy full SHA for 1c53bff
crates/valib-saturators/src/lib.rs
@@ -14,6 +14,7 @@ use std::ops;
14
use clippers::DiodeClipperModel;
15
16
use valib_core::dsp::{DSPMeta, DSPProcess};
17
+use valib_core::math::fast;
18
use valib_core::Scalar;
19
20
pub mod adaa;
@@ -152,13 +153,14 @@ pub struct Tanh;
152
153
impl<S: Scalar> Saturator<S> for Tanh {
154
#[inline(always)]
155
fn saturate(&self, x: S) -> S {
- x.simd_tanh()
156
+ fast::tanh(x)
157
}
158
159
160
#[replace_float_literals(S::from_f64(literal))]
161
fn sat_diff(&self, x: S) -> S {
- 1. - x.simd_tanh().simd_powi(2)
162
+ let tanh = fast::tanh(x);
163
+ 1. - tanh * tanh
164
165
166
0 commit comments