Average Error: 4.8 → 4.8
Time: 11.0s
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 r206135 = x;
        double r206136 = y;
        double r206137 = z;
        double r206138 = r206136 * r206137;
        double r206139 = t;
        double r206140 = r206139 / r206136;
        double r206141 = tanh(r206140);
        double r206142 = r206135 / r206136;
        double r206143 = tanh(r206142);
        double r206144 = r206141 - r206143;
        double r206145 = r206138 * r206144;
        double r206146 = r206135 + r206145;
        return r206146;
}

double f(double x, double y, double z, double t) {
        double r206147 = y;
        double r206148 = z;
        double r206149 = r206147 * r206148;
        double r206150 = t;
        double r206151 = r206150 / r206147;
        double r206152 = tanh(r206151);
        double r206153 = x;
        double r206154 = r206153 / r206147;
        double r206155 = tanh(r206154);
        double r206156 = r206152 - r206155;
        double r206157 = fma(r206149, r206156, r206153);
        return r206157;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.8
Target2.2
Herbie4.8
\[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.8

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

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

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