Average Error: 4.4 → 4.4
Time: 18.2s
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 r14858775 = x;
        double r14858776 = y;
        double r14858777 = z;
        double r14858778 = r14858776 * r14858777;
        double r14858779 = t;
        double r14858780 = r14858779 / r14858776;
        double r14858781 = tanh(r14858780);
        double r14858782 = r14858775 / r14858776;
        double r14858783 = tanh(r14858782);
        double r14858784 = r14858781 - r14858783;
        double r14858785 = r14858778 * r14858784;
        double r14858786 = r14858775 + r14858785;
        return r14858786;
}

double f(double x, double y, double z, double t) {
        double r14858787 = z;
        double r14858788 = y;
        double r14858789 = r14858787 * r14858788;
        double r14858790 = t;
        double r14858791 = r14858790 / r14858788;
        double r14858792 = tanh(r14858791);
        double r14858793 = x;
        double r14858794 = r14858793 / r14858788;
        double r14858795 = tanh(r14858794);
        double r14858796 = r14858792 - r14858795;
        double r14858797 = fma(r14858789, r14858796, r14858793);
        return r14858797;
}

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