Average Error: 4.8 → 1.4
Time: 18.8s
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) \le -9.787277693119323462190151087140993540522 \cdot 10^{113} \lor \neg \left(x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \le 1.538272331212940556859696907235950781054 \cdot 10^{214}\right):\\ \;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\ \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) \le -9.787277693119323462190151087140993540522 \cdot 10^{113} \lor \neg \left(x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \le 1.538272331212940556859696907235950781054 \cdot 10^{214}\right):\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r332564 = x;
        double r332565 = y;
        double r332566 = z;
        double r332567 = r332565 * r332566;
        double r332568 = t;
        double r332569 = r332568 / r332565;
        double r332570 = tanh(r332569);
        double r332571 = r332564 / r332565;
        double r332572 = tanh(r332571);
        double r332573 = r332570 - r332572;
        double r332574 = r332567 * r332573;
        double r332575 = r332564 + r332574;
        return r332575;
}

double f(double x, double y, double z, double t) {
        double r332576 = x;
        double r332577 = y;
        double r332578 = z;
        double r332579 = r332577 * r332578;
        double r332580 = t;
        double r332581 = r332580 / r332577;
        double r332582 = tanh(r332581);
        double r332583 = r332576 / r332577;
        double r332584 = tanh(r332583);
        double r332585 = r332582 - r332584;
        double r332586 = r332579 * r332585;
        double r332587 = r332576 + r332586;
        double r332588 = -9.787277693119323e+113;
        bool r332589 = r332587 <= r332588;
        double r332590 = 1.5382723312129406e+214;
        bool r332591 = r332587 <= r332590;
        double r332592 = !r332591;
        bool r332593 = r332589 || r332592;
        double r332594 = r332578 * r332585;
        double r332595 = r332577 * r332594;
        double r332596 = r332576 + r332595;
        double r332597 = r332593 ? r332596 : r332587;
        return r332597;
}

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.8
Target1.9
Herbie1.4
\[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 2 regimes
  2. if (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < -9.787277693119323e+113 or 1.5382723312129406e+214 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))

    1. Initial program 12.4

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

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

    if -9.787277693119323e+113 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < 1.5382723312129406e+214

    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.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. 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)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.4

    \[\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) \le -9.787277693119323462190151087140993540522 \cdot 10^{113} \lor \neg \left(x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \le 1.538272331212940556859696907235950781054 \cdot 10^{214}\right):\\ \;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\ \end{array}\]

Reproduce

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