Average Error: 4.2 → 4.2
Time: 1.6m
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 r17742801 = x;
        double r17742802 = y;
        double r17742803 = z;
        double r17742804 = r17742802 * r17742803;
        double r17742805 = t;
        double r17742806 = r17742805 / r17742802;
        double r17742807 = tanh(r17742806);
        double r17742808 = r17742801 / r17742802;
        double r17742809 = tanh(r17742808);
        double r17742810 = r17742807 - r17742809;
        double r17742811 = r17742804 * r17742810;
        double r17742812 = r17742801 + r17742811;
        return r17742812;
}

double f(double x, double y, double z, double t) {
        double r17742813 = z;
        double r17742814 = y;
        double r17742815 = r17742813 * r17742814;
        double r17742816 = t;
        double r17742817 = r17742816 / r17742814;
        double r17742818 = tanh(r17742817);
        double r17742819 = x;
        double r17742820 = r17742819 / r17742814;
        double r17742821 = tanh(r17742820);
        double r17742822 = r17742818 - r17742821;
        double r17742823 = fma(r17742815, r17742822, r17742819);
        return r17742823;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.2
Target1.9
Herbie4.2
\[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.2

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

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

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