x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)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) {
return fma(z, (y * (tanh((t / y)) - tanh((x / y)))), x);
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.5 |
|---|---|
| Target | 2.1 |
| Herbie | 1.6 |
Initial program 4.5
Simplified2.1
rmApplied sub-neg2.1
Applied distribute-lft-in2.1
rmApplied fma-udef2.1
Simplified4.5
rmApplied *-commutative4.5
Applied associate-*l*1.6
Applied fma-def1.6
Final simplification1.6
herbie shell --seed 2020078 +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))))))