Average Error: 4.7 → 4.7
Time: 28.6s
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(z \cdot y, \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(z \cdot y, \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 r14521125 = x;
        double r14521126 = y;
        double r14521127 = z;
        double r14521128 = r14521126 * r14521127;
        double r14521129 = t;
        double r14521130 = r14521129 / r14521126;
        double r14521131 = tanh(r14521130);
        double r14521132 = r14521125 / r14521126;
        double r14521133 = tanh(r14521132);
        double r14521134 = r14521131 - r14521133;
        double r14521135 = r14521128 * r14521134;
        double r14521136 = r14521125 + r14521135;
        return r14521136;
}

double f(double x, double y, double z, double t) {
        double r14521137 = z;
        double r14521138 = y;
        double r14521139 = r14521137 * r14521138;
        double r14521140 = t;
        double r14521141 = r14521140 / r14521138;
        double r14521142 = tanh(r14521141);
        double r14521143 = x;
        double r14521144 = r14521143 / r14521138;
        double r14521145 = tanh(r14521144);
        double r14521146 = r14521142 - r14521145;
        double r14521147 = fma(r14521139, r14521146, r14521143);
        return r14521147;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

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

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

Reproduce

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