Average Error: 4.5 → 1.9
Time: 27.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 \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\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 2.405759074108095109916766476323447027402 \cdot 10^{304}:\\ \;\;\;\;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 \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\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 2.405759074108095109916766476323447027402 \cdot 10^{304}:\\
\;\;\;\;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 r22744899 = x;
        double r22744900 = y;
        double r22744901 = z;
        double r22744902 = r22744900 * r22744901;
        double r22744903 = t;
        double r22744904 = r22744903 / r22744900;
        double r22744905 = tanh(r22744904);
        double r22744906 = r22744899 / r22744900;
        double r22744907 = tanh(r22744906);
        double r22744908 = r22744905 - r22744907;
        double r22744909 = r22744902 * r22744908;
        double r22744910 = r22744899 + r22744909;
        return r22744910;
}

double f(double x, double y, double z, double t) {
        double r22744911 = x;
        double r22744912 = y;
        double r22744913 = z;
        double r22744914 = r22744912 * r22744913;
        double r22744915 = t;
        double r22744916 = r22744915 / r22744912;
        double r22744917 = tanh(r22744916);
        double r22744918 = r22744911 / r22744912;
        double r22744919 = tanh(r22744918);
        double r22744920 = r22744917 - r22744919;
        double r22744921 = r22744914 * r22744920;
        double r22744922 = r22744911 + r22744921;
        double r22744923 = -inf.0;
        bool r22744924 = r22744922 <= r22744923;
        double r22744925 = r22744913 * r22744920;
        double r22744926 = r22744912 * r22744925;
        double r22744927 = r22744911 + r22744926;
        double r22744928 = 2.405759074108095e+304;
        bool r22744929 = r22744922 <= r22744928;
        double r22744930 = r22744911 * r22744913;
        double r22744931 = r22744911 - r22744930;
        double r22744932 = r22744929 ? r22744922 : r22744931;
        double r22744933 = r22744924 ? r22744927 : r22744932;
        return r22744933;
}

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.5
Target1.9
Herbie1.9
\[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*1.1

      \[\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 -inf.0 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < 2.405759074108095e+304

    1. Initial program 0.6

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

    if 2.405759074108095e+304 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))

    1. Initial program 59.0

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

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

    \[\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 \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\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 2.405759074108095109916766476323447027402 \cdot 10^{304}:\\ \;\;\;\;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 2019174 
(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))))))