Average Error: 4.6 → 2.4
Time: 9.1s
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 r233268 = x;
        double r233269 = y;
        double r233270 = z;
        double r233271 = r233269 * r233270;
        double r233272 = t;
        double r233273 = r233272 / r233269;
        double r233274 = tanh(r233273);
        double r233275 = r233268 / r233269;
        double r233276 = tanh(r233275);
        double r233277 = r233274 - r233276;
        double r233278 = r233271 * r233277;
        double r233279 = r233268 + r233278;
        return r233279;
}

double f(double x, double y, double z, double t) {
        double r233280 = y;
        double r233281 = z;
        double r233282 = t;
        double r233283 = r233282 / r233280;
        double r233284 = tanh(r233283);
        double r233285 = x;
        double r233286 = r233285 / r233280;
        double r233287 = tanh(r233286);
        double r233288 = r233284 - r233287;
        double r233289 = cbrt(r233288);
        double r233290 = r233289 * r233289;
        double r233291 = r233281 * r233290;
        double r233292 = r233291 * r233289;
        double r233293 = fma(r233280, r233292, r233285);
        return r233293;
}

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))))))