Average Error: 4.7 → 2.9
Time: 3.3m
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 \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 8.52698317017525475 \cdot 10^{304}\right):\\ \;\;\;\;x - x \cdot z\\ \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) = -\infty \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 8.52698317017525475 \cdot 10^{304}\right):\\
\;\;\;\;x - x \cdot z\\

\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 r1999996 = x;
        double r1999997 = y;
        double r1999998 = z;
        double r1999999 = r1999997 * r1999998;
        double r2000000 = t;
        double r2000001 = r2000000 / r1999997;
        double r2000002 = tanh(r2000001);
        double r2000003 = r1999996 / r1999997;
        double r2000004 = tanh(r2000003);
        double r2000005 = r2000002 - r2000004;
        double r2000006 = r1999999 * r2000005;
        double r2000007 = r1999996 + r2000006;
        return r2000007;
}

double f(double x, double y, double z, double t) {
        double r2000008 = x;
        double r2000009 = y;
        double r2000010 = z;
        double r2000011 = r2000009 * r2000010;
        double r2000012 = t;
        double r2000013 = r2000012 / r2000009;
        double r2000014 = tanh(r2000013);
        double r2000015 = r2000008 / r2000009;
        double r2000016 = tanh(r2000015);
        double r2000017 = r2000014 - r2000016;
        double r2000018 = r2000011 * r2000017;
        double r2000019 = r2000008 + r2000018;
        double r2000020 = -inf.0;
        bool r2000021 = r2000019 <= r2000020;
        double r2000022 = 8.526983170175255e+304;
        bool r2000023 = r2000019 <= r2000022;
        double r2000024 = !r2000023;
        bool r2000025 = r2000021 || r2000024;
        double r2000026 = r2000008 * r2000010;
        double r2000027 = r2000008 - r2000026;
        double r2000028 = r2000025 ? r2000027 : r2000019;
        return r2000028;
}

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.7
Target1.9
Herbie2.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 2 regimes
  2. if (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < -inf.0 or 8.526983170175255e+304 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))

    1. Initial program 60.8

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)}\]
    3. Taylor expanded around inf 34.5

      \[\leadsto \color{blue}{x - x \cdot z}\]

    if -inf.0 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < 8.526983170175255e+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)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.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 \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 8.52698317017525475 \cdot 10^{304}\right):\\ \;\;\;\;x - x \cdot z\\ \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 2020018 +o rules:numerics
(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))))))