Average Error: 4.4 → 1.9
Time: 28.7s
Precision: 64
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
\[\left(\left(-z\right) \cdot \tanh \left(\frac{x}{y}\right) + z \cdot \tanh \left(\frac{t}{y}\right)\right) \cdot y + x\]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\left(\left(-z\right) \cdot \tanh \left(\frac{x}{y}\right) + z \cdot \tanh \left(\frac{t}{y}\right)\right) \cdot y + x
double f(double x, double y, double z, double t) {
        double r13540943 = x;
        double r13540944 = y;
        double r13540945 = z;
        double r13540946 = r13540944 * r13540945;
        double r13540947 = t;
        double r13540948 = r13540947 / r13540944;
        double r13540949 = tanh(r13540948);
        double r13540950 = r13540943 / r13540944;
        double r13540951 = tanh(r13540950);
        double r13540952 = r13540949 - r13540951;
        double r13540953 = r13540946 * r13540952;
        double r13540954 = r13540943 + r13540953;
        return r13540954;
}

double f(double x, double y, double z, double t) {
        double r13540955 = z;
        double r13540956 = -r13540955;
        double r13540957 = x;
        double r13540958 = y;
        double r13540959 = r13540957 / r13540958;
        double r13540960 = tanh(r13540959);
        double r13540961 = r13540956 * r13540960;
        double r13540962 = t;
        double r13540963 = r13540962 / r13540958;
        double r13540964 = tanh(r13540963);
        double r13540965 = r13540955 * r13540964;
        double r13540966 = r13540961 + r13540965;
        double r13540967 = r13540966 * r13540958;
        double r13540968 = r13540967 + r13540957;
        return r13540968;
}

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.4
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. Initial program 4.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*1.9

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

    \[\leadsto x + y \cdot \left(z \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(-\tanh \left(\frac{x}{y}\right)\right)\right)}\right)\]
  6. Applied distribute-lft-in1.9

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

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

Reproduce

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