Average Error: 4.4 → 4.4
Time: 20.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 r13183761 = x;
        double r13183762 = y;
        double r13183763 = z;
        double r13183764 = r13183762 * r13183763;
        double r13183765 = t;
        double r13183766 = r13183765 / r13183762;
        double r13183767 = tanh(r13183766);
        double r13183768 = r13183761 / r13183762;
        double r13183769 = tanh(r13183768);
        double r13183770 = r13183767 - r13183769;
        double r13183771 = r13183764 * r13183770;
        double r13183772 = r13183761 + r13183771;
        return r13183772;
}

double f(double x, double y, double z, double t) {
        double r13183773 = z;
        double r13183774 = y;
        double r13183775 = r13183773 * r13183774;
        double r13183776 = t;
        double r13183777 = r13183776 / r13183774;
        double r13183778 = tanh(r13183777);
        double r13183779 = x;
        double r13183780 = r13183779 / r13183774;
        double r13183781 = tanh(r13183780);
        double r13183782 = r13183778 - r13183781;
        double r13183783 = fma(r13183775, r13183782, r13183779);
        return r13183783;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.4
Target1.9
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 2019163 +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))))))