Average Error: 4.7 → 4.7
Time: 22.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 r10719208 = x;
        double r10719209 = y;
        double r10719210 = z;
        double r10719211 = r10719209 * r10719210;
        double r10719212 = t;
        double r10719213 = r10719212 / r10719209;
        double r10719214 = tanh(r10719213);
        double r10719215 = r10719208 / r10719209;
        double r10719216 = tanh(r10719215);
        double r10719217 = r10719214 - r10719216;
        double r10719218 = r10719211 * r10719217;
        double r10719219 = r10719208 + r10719218;
        return r10719219;
}

double f(double x, double y, double z, double t) {
        double r10719220 = y;
        double r10719221 = z;
        double r10719222 = r10719220 * r10719221;
        double r10719223 = t;
        double r10719224 = r10719223 / r10719220;
        double r10719225 = tanh(r10719224);
        double r10719226 = x;
        double r10719227 = r10719226 / r10719220;
        double r10719228 = tanh(r10719227);
        double r10719229 = r10719225 - r10719228;
        double r10719230 = fma(r10719222, r10719229, r10719226);
        return r10719230;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

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

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