Average Error: 4.6 → 4.6
Time: 28.5s
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 \cdot z, \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(y \cdot z, \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 r12440048 = x;
        double r12440049 = y;
        double r12440050 = z;
        double r12440051 = r12440049 * r12440050;
        double r12440052 = t;
        double r12440053 = r12440052 / r12440049;
        double r12440054 = tanh(r12440053);
        double r12440055 = r12440048 / r12440049;
        double r12440056 = tanh(r12440055);
        double r12440057 = r12440054 - r12440056;
        double r12440058 = r12440051 * r12440057;
        double r12440059 = r12440048 + r12440058;
        return r12440059;
}

double f(double x, double y, double z, double t) {
        double r12440060 = y;
        double r12440061 = z;
        double r12440062 = r12440060 * r12440061;
        double r12440063 = t;
        double r12440064 = r12440063 / r12440060;
        double r12440065 = tanh(r12440064);
        double r12440066 = x;
        double r12440067 = r12440066 / r12440060;
        double r12440068 = tanh(r12440067);
        double r12440069 = r12440065 - r12440068;
        double r12440070 = fma(r12440062, r12440069, r12440066);
        return r12440070;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.6
Target2.1
Herbie4.6
\[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.6

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

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

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

Reproduce

herbie shell --seed 2019171 +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))))))