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.2508687094831438 \cdot 10^{+302}:\\
\;\;\;\;x + z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + z \cdot t\right) - x \cdot z\\
\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.2508687094831438e+302)
(+ x (* z (* y (- (tanh (/ t y)) (tanh (/ x y))))))
(- (+ x (* z t)) (* x z))))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.2508687094831438e+302) {
tmp = x + (z * (y * (tanh(t / y) - tanh(x / y))));
} else {
tmp = (x + (z * t)) - (x * z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.7 |
|---|---|
| Target | 2.1 |
| Herbie | 0.9 |
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.25086870948314384e302Initial program 2.1
Simplified0.6
if 1.25086870948314384e302 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 57.7
Simplified21.8
Taylor expanded around inf 7.2
Final simplification0.9
herbie shell --seed 2021176
(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))))))