Average Error: 4.4 → 2.0
Time: 10.9s
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(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\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(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
double f(double x, double y, double z, double t) {
        double r282908 = x;
        double r282909 = y;
        double r282910 = z;
        double r282911 = r282909 * r282910;
        double r282912 = t;
        double r282913 = r282912 / r282909;
        double r282914 = tanh(r282913);
        double r282915 = r282908 / r282909;
        double r282916 = tanh(r282915);
        double r282917 = r282914 - r282916;
        double r282918 = r282911 * r282917;
        double r282919 = r282908 + r282918;
        return r282919;
}

double f(double x, double y, double z, double t) {
        double r282920 = y;
        double r282921 = z;
        double r282922 = t;
        double r282923 = r282922 / r282920;
        double r282924 = tanh(r282923);
        double r282925 = x;
        double r282926 = r282925 / r282920;
        double r282927 = tanh(r282926);
        double r282928 = r282924 - r282927;
        double r282929 = r282921 * r282928;
        double r282930 = fma(r282920, r282929, r282925);
        return r282930;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.4
Target2.0
Herbie2.0
\[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. Simplified2.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)}\]
  3. Final simplification2.0

    \[\leadsto \mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)\]

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (x y z t)
  :name "SynthBasics:moogVCF from YampaSynth-0.2"
  :precision binary64

  :herbie-target
  (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))

  (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))