Average Error: 4.5 → 1.5
Time: 21.0s
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}\;y \le 5.739542871991200764380815182140577584527 \cdot 10^{175}:\\ \;\;\;\;z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\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}\;y \le 5.739542871991200764380815182140577584527 \cdot 10^{175}:\\
\;\;\;\;z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + x\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r220287 = x;
        double r220288 = y;
        double r220289 = z;
        double r220290 = r220288 * r220289;
        double r220291 = t;
        double r220292 = r220291 / r220288;
        double r220293 = tanh(r220292);
        double r220294 = r220287 / r220288;
        double r220295 = tanh(r220294);
        double r220296 = r220293 - r220295;
        double r220297 = r220290 * r220296;
        double r220298 = r220287 + r220297;
        return r220298;
}

double f(double x, double y, double z, double t) {
        double r220299 = y;
        double r220300 = 5.739542871991201e+175;
        bool r220301 = r220299 <= r220300;
        double r220302 = z;
        double r220303 = t;
        double r220304 = r220303 / r220299;
        double r220305 = tanh(r220304);
        double r220306 = x;
        double r220307 = r220306 / r220299;
        double r220308 = tanh(r220307);
        double r220309 = r220305 - r220308;
        double r220310 = r220299 * r220309;
        double r220311 = r220302 * r220310;
        double r220312 = r220311 + r220306;
        double r220313 = r220303 - r220306;
        double r220314 = r220302 * r220313;
        double r220315 = r220306 + r220314;
        double r220316 = r220301 ? r220312 : r220315;
        return r220316;
}

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
Target2.0
Herbie1.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 2 regimes
  2. if y < 5.739542871991201e+175

    1. Initial program 3.2

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}^{1}}\]
    4. Applied pow13.2

      \[\leadsto x + \left(y \cdot \color{blue}{{z}^{1}}\right) \cdot {\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}^{1}\]
    5. Applied pow13.2

      \[\leadsto x + \left(\color{blue}{{y}^{1}} \cdot {z}^{1}\right) \cdot {\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}^{1}\]
    6. Applied pow-prod-down3.2

      \[\leadsto x + \color{blue}{{\left(y \cdot z\right)}^{1}} \cdot {\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}^{1}\]
    7. Applied pow-prod-down3.2

      \[\leadsto x + \color{blue}{{\left(\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}^{1}}\]
    8. Simplified0.9

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

    if 5.739542871991201e+175 < y

    1. Initial program 17.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 pow117.0

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}^{1}}\]
    4. Applied pow117.0

      \[\leadsto x + \left(y \cdot \color{blue}{{z}^{1}}\right) \cdot {\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}^{1}\]
    5. Applied pow117.0

      \[\leadsto x + \left(\color{blue}{{y}^{1}} \cdot {z}^{1}\right) \cdot {\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}^{1}\]
    6. Applied pow-prod-down17.0

      \[\leadsto x + \color{blue}{{\left(y \cdot z\right)}^{1}} \cdot {\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}^{1}\]
    7. Applied pow-prod-down17.0

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

      \[\leadsto x + {\color{blue}{\left(z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\right)}}^{1}\]
    9. Taylor expanded around 0 6.3

      \[\leadsto x + {\left(z \cdot \color{blue}{\left(t - x\right)}\right)}^{1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 5.739542871991200764380815182140577584527 \cdot 10^{175}:\\ \;\;\;\;z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array}\]

Reproduce

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