Average Error: 4.7 → 4.7
Time: 27.4s
Precision: 64
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
\[\mathsf{fma}\left(z \cdot y, \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right), x\right)\]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\mathsf{fma}\left(z \cdot y, \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right), x\right)
double f(double x, double y, double z, double t) {
        double r12345389 = x;
        double r12345390 = y;
        double r12345391 = z;
        double r12345392 = r12345390 * r12345391;
        double r12345393 = t;
        double r12345394 = r12345393 / r12345390;
        double r12345395 = tanh(r12345394);
        double r12345396 = r12345389 / r12345390;
        double r12345397 = tanh(r12345396);
        double r12345398 = r12345395 - r12345397;
        double r12345399 = r12345392 * r12345398;
        double r12345400 = r12345389 + r12345399;
        return r12345400;
}

double f(double x, double y, double z, double t) {
        double r12345401 = z;
        double r12345402 = y;
        double r12345403 = r12345401 * r12345402;
        double r12345404 = t;
        double r12345405 = r12345404 / r12345402;
        double r12345406 = tanh(r12345405);
        double r12345407 = x;
        double r12345408 = r12345407 / r12345402;
        double r12345409 = tanh(r12345408);
        double r12345410 = r12345406 - r12345409;
        double r12345411 = fma(r12345403, r12345410, r12345407);
        return r12345411;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.7
Target2.1
Herbie4.7
\[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.7

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot y, \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right), x\right)}\]
  3. Final simplification4.7

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

Reproduce

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