Average Error: 4.4 → 4.4
Time: 18.1s
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 r10892401 = x;
        double r10892402 = y;
        double r10892403 = z;
        double r10892404 = r10892402 * r10892403;
        double r10892405 = t;
        double r10892406 = r10892405 / r10892402;
        double r10892407 = tanh(r10892406);
        double r10892408 = r10892401 / r10892402;
        double r10892409 = tanh(r10892408);
        double r10892410 = r10892407 - r10892409;
        double r10892411 = r10892404 * r10892410;
        double r10892412 = r10892401 + r10892411;
        return r10892412;
}

double f(double x, double y, double z, double t) {
        double r10892413 = z;
        double r10892414 = y;
        double r10892415 = r10892413 * r10892414;
        double r10892416 = t;
        double r10892417 = r10892416 / r10892414;
        double r10892418 = tanh(r10892417);
        double r10892419 = x;
        double r10892420 = r10892419 / r10892414;
        double r10892421 = tanh(r10892420);
        double r10892422 = r10892418 - r10892421;
        double r10892423 = fma(r10892415, r10892422, r10892419);
        return r10892423;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.4
Target2.0
Herbie4.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.4

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

    \[\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.4

    \[\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 2019169 +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))))))