Average Error: 4.6 → 2.4
Time: 9.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, \left(z \cdot \left(\sqrt[3]{\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)}\right)\right) \cdot \sqrt[3]{\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, \left(z \cdot \left(\sqrt[3]{\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)}\right)\right) \cdot \sqrt[3]{\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 r257410 = x;
        double r257411 = y;
        double r257412 = z;
        double r257413 = r257411 * r257412;
        double r257414 = t;
        double r257415 = r257414 / r257411;
        double r257416 = tanh(r257415);
        double r257417 = r257410 / r257411;
        double r257418 = tanh(r257417);
        double r257419 = r257416 - r257418;
        double r257420 = r257413 * r257419;
        double r257421 = r257410 + r257420;
        return r257421;
}

double f(double x, double y, double z, double t) {
        double r257422 = y;
        double r257423 = z;
        double r257424 = t;
        double r257425 = r257424 / r257422;
        double r257426 = tanh(r257425);
        double r257427 = x;
        double r257428 = r257427 / r257422;
        double r257429 = tanh(r257428);
        double r257430 = r257426 - r257429;
        double r257431 = cbrt(r257430);
        double r257432 = r257431 * r257431;
        double r257433 = r257423 * r257432;
        double r257434 = r257433 * r257431;
        double r257435 = fma(r257422, r257434, r257427);
        return r257435;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.6
Target2.1
Herbie2.4
\[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. 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. Using strategy rm
  4. Applied add-cube-cbrt2.4

    \[\leadsto \mathsf{fma}\left(y, z \cdot \color{blue}{\left(\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)}\right)}, x\right)\]
  5. Applied associate-*r*2.4

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

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

Reproduce

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