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











Bits error versus x











Bits error versus y











Bits error versus z











Bits error versus t
Results
| Original | 4.6 |
|---|---|
| Target | 2.1 |
| Herbie | 1.5 |
| Alternative 1 | |
|---|---|
| Error | 10.4 |
| Cost | 8260 |
| Alternative 2 | |
|---|---|
| Error | 15.2 |
| Cost | 776 |
| Alternative 3 | |
|---|---|
| Error | 21.0 |
| Cost | 648 |
| Alternative 4 | |
|---|---|
| Error | 22.9 |
| Cost | 834 |
| Alternative 5 | |
|---|---|
| Error | 23.2 |
| Cost | 64 |
| Alternative 6 | |
|---|---|
| Error | 61.7 |
| Cost | 64 |
| Alternative 7 | |
|---|---|
| Error | 61.8 |
| Cost | 64 |

if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 2.0153449175156312e300Initial program 2.3
rmApplied associate-*l*_binary64_112721.2
Simplified1.2
if 2.0153449175156312e300 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 52.4
Taylor expanded around inf 8.1
Simplified8.1
Simplified8.1
Final simplification1.5
herbie shell --seed 2021044
(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))))))