Average Error: 4.7 → 4.7
Time: 36.8s
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 r16100616 = x;
        double r16100617 = y;
        double r16100618 = z;
        double r16100619 = r16100617 * r16100618;
        double r16100620 = t;
        double r16100621 = r16100620 / r16100617;
        double r16100622 = tanh(r16100621);
        double r16100623 = r16100616 / r16100617;
        double r16100624 = tanh(r16100623);
        double r16100625 = r16100622 - r16100624;
        double r16100626 = r16100619 * r16100625;
        double r16100627 = r16100616 + r16100626;
        return r16100627;
}

double f(double x, double y, double z, double t) {
        double r16100628 = z;
        double r16100629 = y;
        double r16100630 = r16100628 * r16100629;
        double r16100631 = t;
        double r16100632 = r16100631 / r16100629;
        double r16100633 = tanh(r16100632);
        double r16100634 = x;
        double r16100635 = r16100634 / r16100629;
        double r16100636 = tanh(r16100635);
        double r16100637 = r16100633 - r16100636;
        double r16100638 = fma(r16100630, r16100637, r16100634);
        return r16100638;
}

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 2019165 +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))))))