Average Error: 4.1 → 4.1
Time: 1.6m
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 r16772510 = x;
        double r16772511 = y;
        double r16772512 = z;
        double r16772513 = r16772511 * r16772512;
        double r16772514 = t;
        double r16772515 = r16772514 / r16772511;
        double r16772516 = tanh(r16772515);
        double r16772517 = r16772510 / r16772511;
        double r16772518 = tanh(r16772517);
        double r16772519 = r16772516 - r16772518;
        double r16772520 = r16772513 * r16772519;
        double r16772521 = r16772510 + r16772520;
        return r16772521;
}

double f(double x, double y, double z, double t) {
        double r16772522 = z;
        double r16772523 = y;
        double r16772524 = r16772522 * r16772523;
        double r16772525 = t;
        double r16772526 = r16772525 / r16772523;
        double r16772527 = tanh(r16772526);
        double r16772528 = x;
        double r16772529 = r16772528 / r16772523;
        double r16772530 = tanh(r16772529);
        double r16772531 = r16772527 - r16772530;
        double r16772532 = fma(r16772524, r16772531, r16772528);
        return r16772532;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

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

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