Average Error: 4.4 → 4.4
Time: 17.4s
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 r16572947 = x;
        double r16572948 = y;
        double r16572949 = z;
        double r16572950 = r16572948 * r16572949;
        double r16572951 = t;
        double r16572952 = r16572951 / r16572948;
        double r16572953 = tanh(r16572952);
        double r16572954 = r16572947 / r16572948;
        double r16572955 = tanh(r16572954);
        double r16572956 = r16572953 - r16572955;
        double r16572957 = r16572950 * r16572956;
        double r16572958 = r16572947 + r16572957;
        return r16572958;
}

double f(double x, double y, double z, double t) {
        double r16572959 = z;
        double r16572960 = y;
        double r16572961 = r16572959 * r16572960;
        double r16572962 = t;
        double r16572963 = r16572962 / r16572960;
        double r16572964 = tanh(r16572963);
        double r16572965 = x;
        double r16572966 = r16572965 / r16572960;
        double r16572967 = tanh(r16572966);
        double r16572968 = r16572964 - r16572967;
        double r16572969 = fma(r16572961, r16572968, r16572965);
        return r16572969;
}

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