Average Error: 4.5 → 4.5
Time: 55.7s
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 \cdot z, \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 \cdot z, \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 r16520780 = x;
        double r16520781 = y;
        double r16520782 = z;
        double r16520783 = r16520781 * r16520782;
        double r16520784 = t;
        double r16520785 = r16520784 / r16520781;
        double r16520786 = tanh(r16520785);
        double r16520787 = r16520780 / r16520781;
        double r16520788 = tanh(r16520787);
        double r16520789 = r16520786 - r16520788;
        double r16520790 = r16520783 * r16520789;
        double r16520791 = r16520780 + r16520790;
        return r16520791;
}

double f(double x, double y, double z, double t) {
        double r16520792 = y;
        double r16520793 = z;
        double r16520794 = r16520792 * r16520793;
        double r16520795 = t;
        double r16520796 = r16520795 / r16520792;
        double r16520797 = tanh(r16520796);
        double r16520798 = x;
        double r16520799 = r16520798 / r16520792;
        double r16520800 = tanh(r16520799);
        double r16520801 = r16520797 - r16520800;
        double r16520802 = fma(r16520794, r16520801, r16520798);
        return r16520802;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.5
Target1.9
Herbie4.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. Simplified4.5

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

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

Reproduce

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