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) = -\infty \lor \neg \left(x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \le 4.10357166055870129 \cdot 10^{304}\right):\\
\;\;\;\;x - x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}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 VAR;
if ((((x + ((y * z) * (tanh((t / y)) - tanh((x / y))))) <= -inf.0) || !((x + ((y * z) * (tanh((t / y)) - tanh((x / y))))) <= 4.1035716605587013e+304))) {
VAR = (x - (x * z));
} else {
VAR = (x + ((y * z) * (tanh((t / y)) - tanh((x / y)))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.4 |
|---|---|
| Target | 2.0 |
| Herbie | 2.8 |
if (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < -inf.0 or 4.1035716605587013e+304 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) Initial program 60.9
Simplified13.9
Taylor expanded around inf 35.5
if -inf.0 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < 4.1035716605587013e+304Initial program 0.6
Final simplification2.8
herbie shell --seed 2020091 +o rules:numerics
(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))))))