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 3.0024119128856031 \cdot 10^{307}\right):\\
\;\;\;\;\left(\sqrt[3]{\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)} \cdot \sqrt[3]{\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\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}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 temp;
if ((((x + ((y * z) * (tanh((t / y)) - tanh((x / y))))) <= -inf.0) || !((x + ((y * z) * (tanh((t / y)) - tanh((x / y))))) <= 3.002411912885603e+307))) {
temp = ((cbrt(fma(y, (z * (tanh((t / y)) - tanh((x / y)))), x)) * cbrt(fma(y, (z * (tanh((t / y)) - tanh((x / y)))), x))) * cbrt(fma(y, (z * (tanh((t / y)) - tanh((x / y)))), x)));
} else {
temp = (x + ((y * z) * (tanh((t / y)) - tanh((x / y)))));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.4 |
|---|---|
| Target | 1.9 |
| Herbie | 1.5 |
if (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < -inf.0 or 3.002411912885603e+307 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) Initial program 63.3
Simplified15.9
rmApplied add-cube-cbrt16.6
if -inf.0 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < 3.002411912885603e+307Initial program 0.5
Final simplification1.5
herbie shell --seed 2020066 +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))))))