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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.8 |
|---|---|
| Target | 2.0 |
| Herbie | 1.6 |
if y < -1.307953264035108e223Initial program 20.1
Taylor expanded around inf 2.7
Simplified2.7
if -1.307953264035108e223 < y Initial program 3.8
rmApplied associate-*l*_binary64_68391.5
Final simplification1.6
herbie shell --seed 2021014
(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))))))