Average Error: 4.6 → 3.5
Time: 6.3s
Precision: 64
\[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:\\ \;\;\;\;x + y \cdot \frac{t \cdot z}{y}\\ \mathbf{elif}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \le 9.752063034210752310871810357187000409691 \cdot 10^{287}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot z\\ \end{array}\]
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:\\
\;\;\;\;x + y \cdot \frac{t \cdot z}{y}\\

\mathbf{elif}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \le 9.752063034210752310871810357187000409691 \cdot 10^{287}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x - x \cdot z\\

\end{array}
double f(double x, double y, double z, double t) {
        double r323825 = x;
        double r323826 = y;
        double r323827 = z;
        double r323828 = r323826 * r323827;
        double r323829 = t;
        double r323830 = r323829 / r323826;
        double r323831 = tanh(r323830);
        double r323832 = r323825 / r323826;
        double r323833 = tanh(r323832);
        double r323834 = r323831 - r323833;
        double r323835 = r323828 * r323834;
        double r323836 = r323825 + r323835;
        return r323836;
}

double f(double x, double y, double z, double t) {
        double r323837 = x;
        double r323838 = y;
        double r323839 = z;
        double r323840 = r323838 * r323839;
        double r323841 = t;
        double r323842 = r323841 / r323838;
        double r323843 = tanh(r323842);
        double r323844 = r323837 / r323838;
        double r323845 = tanh(r323844);
        double r323846 = r323843 - r323845;
        double r323847 = r323840 * r323846;
        double r323848 = r323837 + r323847;
        double r323849 = -inf.0;
        bool r323850 = r323848 <= r323849;
        double r323851 = r323841 * r323839;
        double r323852 = r323851 / r323838;
        double r323853 = r323838 * r323852;
        double r323854 = r323837 + r323853;
        double r323855 = 9.752063034210752e+287;
        bool r323856 = r323848 <= r323855;
        double r323857 = r323837 * r323839;
        double r323858 = r323837 - r323857;
        double r323859 = r323856 ? r323848 : r323858;
        double r323860 = r323850 ? r323854 : r323859;
        return r323860;
}

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.6
Target2.1
Herbie3.5
\[x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\]

Derivation

  1. Split input into 3 regimes
  2. if (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < -inf.0

    1. Initial program 64.0

      \[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 associate-*l*2.5

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}\]
    4. Taylor expanded around inf 30.6

      \[\leadsto x + y \cdot \color{blue}{\frac{t \cdot z}{y}}\]

    if -inf.0 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < 9.752063034210752e+287

    1. Initial program 0.8

      \[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 associate-*l*1.2

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}\]
    4. Using strategy rm
    5. Applied associate-*r*0.8

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

    if 9.752063034210752e+287 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))

    1. Initial program 42.1

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
    2. Taylor expanded around 0 35.3

      \[\leadsto \color{blue}{x - x \cdot z}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.5

    \[\leadsto \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:\\ \;\;\;\;x + y \cdot \frac{t \cdot z}{y}\\ \mathbf{elif}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \le 9.752063034210752310871810357187000409691 \cdot 10^{287}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot z\\ \end{array}\]

Reproduce

herbie shell --seed 2020002 
(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))))))