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:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t \cdot z}{y} + z \cdot \left(-\tanh \left(\frac{x}{y}\right)\right), x\right)\\
\mathbf{elif}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \le 7.3734911360919146 \cdot 10^{307}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left(\mathsf{fma}\left(y, z \cdot \tanh \left(\frac{t}{y}\right) + z \cdot \left(-\tanh \left(\frac{x}{y}\right)\right), x\right)\right)}\\
\end{array}double f(double x, double y, double z, double t) {
double r418019 = x;
double r418020 = y;
double r418021 = z;
double r418022 = r418020 * r418021;
double r418023 = t;
double r418024 = r418023 / r418020;
double r418025 = tanh(r418024);
double r418026 = r418019 / r418020;
double r418027 = tanh(r418026);
double r418028 = r418025 - r418027;
double r418029 = r418022 * r418028;
double r418030 = r418019 + r418029;
return r418030;
}
double f(double x, double y, double z, double t) {
double r418031 = x;
double r418032 = y;
double r418033 = z;
double r418034 = r418032 * r418033;
double r418035 = t;
double r418036 = r418035 / r418032;
double r418037 = tanh(r418036);
double r418038 = r418031 / r418032;
double r418039 = tanh(r418038);
double r418040 = r418037 - r418039;
double r418041 = r418034 * r418040;
double r418042 = r418031 + r418041;
double r418043 = -inf.0;
bool r418044 = r418042 <= r418043;
double r418045 = r418035 * r418033;
double r418046 = r418045 / r418032;
double r418047 = -r418039;
double r418048 = r418033 * r418047;
double r418049 = r418046 + r418048;
double r418050 = fma(r418032, r418049, r418031);
double r418051 = 7.373491136091915e+307;
bool r418052 = r418042 <= r418051;
double r418053 = r418033 * r418037;
double r418054 = r418053 + r418048;
double r418055 = fma(r418032, r418054, r418031);
double r418056 = log(r418055);
double r418057 = exp(r418056);
double r418058 = r418052 ? r418042 : r418057;
double r418059 = r418044 ? r418050 : r418058;
return r418059;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 5.0 |
|---|---|
| Target | 2.1 |
| Herbie | 1.8 |
if (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < -inf.0Initial program 64.0
Simplified1.8
rmApplied sub-neg1.8
Applied distribute-lft-in1.8
Taylor expanded around inf 0.8
if -inf.0 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < 7.373491136091915e+307Initial program 0.6
if 7.373491136091915e+307 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) Initial program 63.1
Simplified20.5
rmApplied sub-neg20.5
Applied distribute-lft-in20.5
rmApplied add-exp-log26.5
Final simplification1.8
herbie shell --seed 2020083 +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))))))