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 -\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) \leq 1.9072265688125544 \cdot 10^{+306}\right):\\
\;\;\;\;x + \left(z \cdot t - x \cdot z\right)\\
\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}(FPCore (x y z t) :precision binary64 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
(FPCore (x y z t)
:precision binary64
(if (or (<= (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) (- INFINITY))
(not
(<=
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))
1.9072265688125544e+306)))
(+ x (- (* z t) (* x z)))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))))double code(double x, double y, double z, double t) {
return ((double) (x + ((double) (((double) (y * z)) * ((double) (((double) tanh((t / y))) - ((double) tanh((x / y)))))))));
}
double code(double x, double y, double z, double t) {
double VAR;
if (((((double) (x + ((double) (((double) (y * z)) * ((double) (((double) tanh((t / y))) - ((double) tanh((x / y))))))))) <= ((double) -(((double) INFINITY)))) || !(((double) (x + ((double) (((double) (y * z)) * ((double) (((double) tanh((t / y))) - ((double) tanh((x / y))))))))) <= 1.9072265688125544e+306))) {
VAR = ((double) (x + ((double) (((double) (z * t)) - ((double) (x * z))))));
} else {
VAR = ((double) (x + ((double) (((double) (y * z)) * ((double) (((double) tanh((t / y))) - ((double) 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 | 1.9 |
| Herbie | 0.8 |
if (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < -inf.0 or 1.9072265688125544e306 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) Initial program 62.3
Simplified13.9
rmApplied sub-neg13.9
Applied distribute-lft-in13.9
Applied distribute-lft-in16.6
Taylor expanded around 0 10.5
Simplified10.5
Taylor expanded around 0 3.4
Simplified3.4
if -inf.0 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < 1.9072265688125544e306Initial program 0.6
Final simplification0.8
herbie shell --seed 2020198
(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))))))