Average Error: 4.8 → 4.8
Time: 5.6s
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 -2.228420863208462712671433486789655991657 \cdot 10^{266}:\\ \;\;\;\;x - x \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x\\ \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 -2.228420863208462712671433486789655991657 \cdot 10^{266}:\\
\;\;\;\;x - x \cdot z\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r207330 = x;
        double r207331 = y;
        double r207332 = z;
        double r207333 = r207331 * r207332;
        double r207334 = t;
        double r207335 = r207334 / r207331;
        double r207336 = tanh(r207335);
        double r207337 = r207330 / r207331;
        double r207338 = tanh(r207337);
        double r207339 = r207336 - r207338;
        double r207340 = r207333 * r207339;
        double r207341 = r207330 + r207340;
        return r207341;
}

double f(double x, double y, double z, double t) {
        double r207342 = y;
        double r207343 = -2.2284208632084627e+266;
        bool r207344 = r207342 <= r207343;
        double r207345 = x;
        double r207346 = z;
        double r207347 = r207345 * r207346;
        double r207348 = r207345 - r207347;
        double r207349 = r207342 * r207346;
        double r207350 = t;
        double r207351 = r207350 / r207342;
        double r207352 = tanh(r207351);
        double r207353 = r207345 / r207342;
        double r207354 = tanh(r207353);
        double r207355 = r207352 - r207354;
        double r207356 = r207349 * r207355;
        double r207357 = r207356 + r207345;
        double r207358 = r207344 ? r207348 : r207357;
        return r207358;
}

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
Target2.1
Herbie4.8
\[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 < -2.2284208632084627e+266

    1. Initial program 19.4

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

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

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

    if -2.2284208632084627e+266 < y

    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. Simplified1.9

      \[\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. Using strategy rm
    4. Applied fma-udef1.9

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + x}\]
    5. Using strategy rm
    6. Applied associate-*r*4.4

      \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} + x\]
  3. Recombined 2 regimes into one program.
  4. Final simplification4.8

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

Reproduce

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