Average Error: 4.8 → 2.1
Time: 6.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(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\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, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
double f(double x, double y, double z, double t) {
        double r224473 = x;
        double r224474 = y;
        double r224475 = z;
        double r224476 = r224474 * r224475;
        double r224477 = t;
        double r224478 = r224477 / r224474;
        double r224479 = tanh(r224478);
        double r224480 = r224473 / r224474;
        double r224481 = tanh(r224480);
        double r224482 = r224479 - r224481;
        double r224483 = r224476 * r224482;
        double r224484 = r224473 + r224483;
        return r224484;
}

double f(double x, double y, double z, double t) {
        double r224485 = y;
        double r224486 = z;
        double r224487 = t;
        double r224488 = r224487 / r224485;
        double r224489 = tanh(r224488);
        double r224490 = x;
        double r224491 = r224490 / r224485;
        double r224492 = tanh(r224491);
        double r224493 = r224489 - r224492;
        double r224494 = r224486 * r224493;
        double r224495 = fma(r224485, r224494, r224490);
        return r224495;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.8
Target2.1
Herbie2.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.8

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

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

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

Reproduce

herbie shell --seed 2019356 +o rules:numerics
(FPCore (x y z t)
  :name "SynthBasics:moogVCF from YampaSynth-0.2"
  :precision binary64

  :herbie-target
  (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))

  (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))