Average Error: 4.9 → 1.6
Time: 21.4s
Precision: 64
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
\[\left(z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + z \cdot \left(y \cdot \left(0 \cdot \tanh \left(\frac{x}{y}\right)\right)\right)\right) + x\]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\left(z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + z \cdot \left(y \cdot \left(0 \cdot \tanh \left(\frac{x}{y}\right)\right)\right)\right) + x
double f(double x, double y, double z, double t) {
        double r11692677 = x;
        double r11692678 = y;
        double r11692679 = z;
        double r11692680 = r11692678 * r11692679;
        double r11692681 = t;
        double r11692682 = r11692681 / r11692678;
        double r11692683 = tanh(r11692682);
        double r11692684 = r11692677 / r11692678;
        double r11692685 = tanh(r11692684);
        double r11692686 = r11692683 - r11692685;
        double r11692687 = r11692680 * r11692686;
        double r11692688 = r11692677 + r11692687;
        return r11692688;
}

double f(double x, double y, double z, double t) {
        double r11692689 = z;
        double r11692690 = y;
        double r11692691 = t;
        double r11692692 = r11692691 / r11692690;
        double r11692693 = tanh(r11692692);
        double r11692694 = x;
        double r11692695 = r11692694 / r11692690;
        double r11692696 = tanh(r11692695);
        double r11692697 = r11692693 - r11692696;
        double r11692698 = r11692690 * r11692697;
        double r11692699 = r11692689 * r11692698;
        double r11692700 = 0.0;
        double r11692701 = r11692700 * r11692696;
        double r11692702 = r11692690 * r11692701;
        double r11692703 = r11692689 * r11692702;
        double r11692704 = r11692699 + r11692703;
        double r11692705 = r11692704 + r11692694;
        return r11692705;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original4.9
Target2.0
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.9

    \[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.9

    \[\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-sqr-sqrt32.3

    \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\sqrt{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt{\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-diff32.3

    \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{\tanh \left(\frac{t}{y}\right)}, \sqrt{\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-in32.3

    \[\leadsto x + \color{blue}{\left(\left(y \cdot z\right) \cdot \mathsf{fma}\left(\sqrt{\tanh \left(\frac{t}{y}\right)}, \sqrt{\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.9

    \[\leadsto x + \left(\color{blue}{z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \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)\]
  8. Simplified1.6

    \[\leadsto x + \left(z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + \color{blue}{z \cdot \left(y \cdot \left(\tanh \left(\frac{x}{y}\right) \cdot 0\right)\right)}\right)\]
  9. Final simplification1.6

    \[\leadsto \left(z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + z \cdot \left(y \cdot \left(0 \cdot \tanh \left(\frac{x}{y}\right)\right)\right)\right) + x\]

Reproduce

herbie shell --seed 2019192 +o rules:numerics
(FPCore (x y z t)
  :name "SynthBasics:moogVCF from YampaSynth-0.2"

  :herbie-target
  (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))

  (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))