Average Error: 4.5 → 1.5
Time: 24.9s
Precision: 64
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
\[x + \left(\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot z + y \cdot \left(z \cdot \left(\tanh \left(\frac{x}{y}\right) \cdot 0\right)\right)\right)\]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
x + \left(\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot z + y \cdot \left(z \cdot \left(\tanh \left(\frac{x}{y}\right) \cdot 0\right)\right)\right)
double f(double x, double y, double z, double t) {
        double r209314 = x;
        double r209315 = y;
        double r209316 = z;
        double r209317 = r209315 * r209316;
        double r209318 = t;
        double r209319 = r209318 / r209315;
        double r209320 = tanh(r209319);
        double r209321 = r209314 / r209315;
        double r209322 = tanh(r209321);
        double r209323 = r209320 - r209322;
        double r209324 = r209317 * r209323;
        double r209325 = r209314 + r209324;
        return r209325;
}

double f(double x, double y, double z, double t) {
        double r209326 = x;
        double r209327 = y;
        double r209328 = t;
        double r209329 = r209328 / r209327;
        double r209330 = tanh(r209329);
        double r209331 = r209326 / r209327;
        double r209332 = tanh(r209331);
        double r209333 = r209330 - r209332;
        double r209334 = r209327 * r209333;
        double r209335 = z;
        double r209336 = r209334 * r209335;
        double r209337 = 0.0;
        double r209338 = r209332 * r209337;
        double r209339 = r209335 * r209338;
        double r209340 = r209327 * r209339;
        double r209341 = r209336 + r209340;
        double r209342 = r209326 + r209341;
        return r209342;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

    \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
  2. Using strategy rm
  3. Applied add-cube-cbrt4.5

    \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}}\right)\]
  4. Applied add-sqr-sqrt31.5

    \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\sqrt{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt{\tanh \left(\frac{t}{y}\right)}} - \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\]
  5. Applied prod-diff31.5

    \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{\tanh \left(\frac{t}{y}\right)}, \sqrt{\tanh \left(\frac{t}{y}\right)}, -\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right)\right)}\]
  6. Applied distribute-lft-in31.5

    \[\leadsto x + \color{blue}{\left(\left(y \cdot z\right) \cdot \mathsf{fma}\left(\sqrt{\tanh \left(\frac{t}{y}\right)}, \sqrt{\tanh \left(\frac{t}{y}\right)}, -\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right) + \left(y \cdot z\right) \cdot \mathsf{fma}\left(-\sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right)\right)}\]
  7. Simplified4.5

    \[\leadsto x + \left(\color{blue}{\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot z} + \left(y \cdot z\right) \cdot \mathsf{fma}\left(-\sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}, \sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \left(\sqrt[3]{\tanh \left(\frac{x}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{x}{y}\right)}\right)\right)\right)\]
  8. Simplified1.5

    \[\leadsto x + \left(\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot z + \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{x}{y}\right) \cdot 0\right)\right)}\right)\]
  9. Final simplification1.5

    \[\leadsto x + \left(\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot z + y \cdot \left(z \cdot \left(\tanh \left(\frac{x}{y}\right) \cdot 0\right)\right)\right)\]

Reproduce

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