x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\begin{array}{l}
\mathbf{if}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq 1.1321646416102859 \cdot 10^{+297}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}(FPCore (x y z t) :precision binary64 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
(FPCore (x y z t)
:precision binary64
(if (<=
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))
1.1321646416102859e+297)
(+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))
(+ x (* z (- t x)))))double code(double x, double y, double z, double t) {
return x + ((y * z) * (tanh(t / y) - tanh(x / y)));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((x + ((y * z) * (tanh(t / y) - tanh(x / y)))) <= 1.1321646416102859e+297) {
tmp = x + (y * (z * (tanh(t / y) - tanh(x / y))));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.6 |
|---|---|
| Target | 2.2 |
| Herbie | 1.8 |
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.1321646416102859e297Initial program 2.2
rmApplied associate-*l*_binary641.3
if 1.1321646416102859e297 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 51.0
Taylor expanded around inf 11.2
Simplified11.2
Final simplification1.8
herbie shell --seed 2021110
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:herbie-target
(+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))