Average Error: 4.3 → 1.6
Time: 14.2s
Precision: 64
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
\[x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + e^{\log 0}\right)\]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + e^{\log 0}\right)
double f(double x, double y, double z, double t) {
        double r277363 = x;
        double r277364 = y;
        double r277365 = z;
        double r277366 = r277364 * r277365;
        double r277367 = t;
        double r277368 = r277367 / r277364;
        double r277369 = tanh(r277368);
        double r277370 = r277363 / r277364;
        double r277371 = tanh(r277370);
        double r277372 = r277369 - r277371;
        double r277373 = r277366 * r277372;
        double r277374 = r277363 + r277373;
        return r277374;
}

double f(double x, double y, double z, double t) {
        double r277375 = x;
        double r277376 = t;
        double r277377 = y;
        double r277378 = r277376 / r277377;
        double r277379 = tanh(r277378);
        double r277380 = cbrt(r277379);
        double r277381 = r277380 * r277380;
        double r277382 = r277375 / r277377;
        double r277383 = tanh(r277382);
        double r277384 = -r277383;
        double r277385 = fma(r277381, r277380, r277384);
        double r277386 = r277385 * r277377;
        double r277387 = z;
        double r277388 = r277386 * r277387;
        double r277389 = 0.0;
        double r277390 = log(r277389);
        double r277391 = exp(r277390);
        double r277392 = r277388 + r277391;
        double r277393 = r277375 + r277392;
        return r277393;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.3
Target2.1
Herbie1.6
\[x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\]

Derivation

  1. Initial program 4.3

    \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
  2. Using strategy rm
  3. Applied add-cube-cbrt4.4

    \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}}\right)\]
  4. Applied add-cube-cbrt4.5

    \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}} - \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\]
  5. Applied prod-diff4.5

    \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right)\right)}\]
  6. Applied distribute-lft-in4.5

    \[\leadsto x + \color{blue}{\left(\left(y \cdot z\right) \cdot \mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right) + \left(y \cdot z\right) \cdot \mathsf{fma}\left(-\sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right)\right)}\]
  7. Simplified4.4

    \[\leadsto x + \left(\color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z} + \left(y \cdot z\right) \cdot \mathsf{fma}\left(-\sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right)\right)\]
  8. Simplified4.4

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + \color{blue}{\left(\tanh \left(\frac{x}{y}\right) \cdot 0\right) \cdot \left(y \cdot z\right)}\right)\]
  9. Using strategy rm
  10. Applied add-exp-log34.4

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + \left(\tanh \left(\frac{x}{y}\right) \cdot 0\right) \cdot \left(y \cdot \color{blue}{e^{\log z}}\right)\right)\]
  11. Applied add-exp-log49.4

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + \left(\tanh \left(\frac{x}{y}\right) \cdot 0\right) \cdot \left(\color{blue}{e^{\log y}} \cdot e^{\log z}\right)\right)\]
  12. Applied prod-exp49.4

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + \left(\tanh \left(\frac{x}{y}\right) \cdot 0\right) \cdot \color{blue}{e^{\log y + \log z}}\right)\]
  13. Applied add-exp-log49.4

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + \left(\tanh \left(\frac{x}{y}\right) \cdot \color{blue}{e^{\log 0}}\right) \cdot e^{\log y + \log z}\right)\]
  14. Applied add-exp-log55.8

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + \left(\color{blue}{e^{\log \left(\tanh \left(\frac{x}{y}\right)\right)}} \cdot e^{\log 0}\right) \cdot e^{\log y + \log z}\right)\]
  15. Applied prod-exp55.8

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + \color{blue}{e^{\log \left(\tanh \left(\frac{x}{y}\right)\right) + \log 0}} \cdot e^{\log y + \log z}\right)\]
  16. Applied prod-exp55.4

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + \color{blue}{e^{\left(\log \left(\tanh \left(\frac{x}{y}\right)\right) + \log 0\right) + \left(\log y + \log z\right)}}\right)\]
  17. Simplified1.6

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + e^{\color{blue}{\log 0}}\right)\]
  18. Final simplification1.6

    \[\leadsto x + \left(\left(\mathsf{fma}\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, \sqrt[3]{\tanh \left(\frac{t}{y}\right)}, -\tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z + e^{\log 0}\right)\]

Reproduce

herbie shell --seed 2020045 +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))))))