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}\;y \le -1.1600489093627797 \cdot 10^{137}:\\
\;\;\;\;\mathsf{fma}\left(z, t, x - x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \tanh \left(\frac{t}{y}\right) + z \cdot \left(-\tanh \left(\frac{x}{y}\right)\right), x\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 ((y <= -1.1600489093627797e+137)) {
VAR = fma(z, t, (x - (x * z)));
} else {
VAR = fma(y, ((z * tanh((t / y))) + (z * -tanh((x / y)))), x);
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.7 |
|---|---|
| Target | 2.1 |
| Herbie | 2.0 |
if y < -1.1600489093627797e+137Initial program 15.8
rmApplied sub-neg15.8
Applied distribute-lft-in15.8
Applied associate-+r+16.0
Simplified15.9
Taylor expanded around inf 7.1
Simplified7.1
if -1.1600489093627797e+137 < y Initial program 3.1
Simplified1.2
rmApplied sub-neg1.2
Applied distribute-lft-in1.2
Final simplification2.0
herbie shell --seed 2020103 +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))))))