Average Error: 4.9 → 1.6
Time: 5.7s
Precision: binary64
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
\[x + z \cdot \left(y \cdot \tanh \left(\frac{t}{y}\right) - y \cdot \tanh \left(\frac{x}{y}\right)\right)\]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
x + z \cdot \left(y \cdot \tanh \left(\frac{t}{y}\right) - y \cdot \tanh \left(\frac{x}{y}\right)\right)
(FPCore (x y z t)
 :precision binary64
 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
(FPCore (x y z t)
 :precision binary64
 (+ x (* z (- (* y (tanh (/ t y))) (* y (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
	return x + ((y * z) * (tanh(t / y) - tanh(x / y)));
}
double code(double x, double y, double z, double t) {
	return x + (z * ((y * tanh(t / y)) - (y * tanh(x / y))));
}

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.9
Target2.2
Herbie1.6
\[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.9

    \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
  2. Taylor expanded around inf 38.6

    \[\leadsto x + \color{blue}{z \cdot \left(y \cdot \left(\left(\frac{e^{-2 \cdot \frac{x}{y}}}{e^{-2 \cdot \frac{x}{y}} + 1} + \frac{1}{e^{-2 \cdot \frac{t}{y}} + 1}\right) - \left(\frac{1}{e^{-2 \cdot \frac{x}{y}} + 1} + \frac{e^{-2 \cdot \frac{t}{y}}}{e^{-2 \cdot \frac{t}{y}} + 1}\right)\right)\right)}\]
  3. Simplified1.6

    \[\leadsto x + \color{blue}{z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity_binary641.6

    \[\leadsto x + z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{1 \cdot \tanh \left(\frac{x}{y}\right)}\right)\right)\]
  6. Applied cancel-sign-sub-inv_binary641.6

    \[\leadsto x + z \cdot \left(y \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(-1\right) \cdot \tanh \left(\frac{x}{y}\right)\right)}\right)\]
  7. Applied distribute-rgt-in_binary641.6

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

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

Alternatives

Reproduce

herbie shell --seed 2021118 
(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))))))