Average Error: 4.6 → 1.4
Time: 21.2s
Precision: 64
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
\[z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + x\]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + x
double f(double x, double y, double z, double t) {
        double r15038435 = x;
        double r15038436 = y;
        double r15038437 = z;
        double r15038438 = r15038436 * r15038437;
        double r15038439 = t;
        double r15038440 = r15038439 / r15038436;
        double r15038441 = tanh(r15038440);
        double r15038442 = r15038435 / r15038436;
        double r15038443 = tanh(r15038442);
        double r15038444 = r15038441 - r15038443;
        double r15038445 = r15038438 * r15038444;
        double r15038446 = r15038435 + r15038445;
        return r15038446;
}

double f(double x, double y, double z, double t) {
        double r15038447 = z;
        double r15038448 = y;
        double r15038449 = t;
        double r15038450 = r15038449 / r15038448;
        double r15038451 = tanh(r15038450);
        double r15038452 = x;
        double r15038453 = r15038452 / r15038448;
        double r15038454 = tanh(r15038453);
        double r15038455 = r15038451 - r15038454;
        double r15038456 = r15038448 * r15038455;
        double r15038457 = r15038447 * r15038456;
        double r15038458 = r15038457 + r15038452;
        return r15038458;
}

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.6
Target1.9
Herbie1.4
\[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.6

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot y, \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right), x\right)}\]
  3. Using strategy rm
  4. Applied log1p-expm1-u4.6

    \[\leadsto \mathsf{fma}\left(z \cdot y, \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}, x\right)\]
  5. Using strategy rm
  6. Applied fma-udef4.6

    \[\leadsto \color{blue}{\left(z \cdot y\right) \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) + x}\]
  7. Simplified1.4

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

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

Reproduce

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