Average Error: 4.7 → 2.7
Time: 8.5s
Precision: 64
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.0912622621729367 \cdot 10^{206}:\\ \;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right) + -1 \cdot \frac{x \cdot z}{y}\right)\\ \mathbf{elif}\;y \le 6.07031039754652855 \cdot 10^{71}:\\ \;\;\;\;x + \left(\left(y \cdot z\right) \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)}\\ \mathbf{else}:\\ \;\;\;\;x + \sqrt{y} \cdot \left(\sqrt{y} \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\right)\\ \end{array}\]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\begin{array}{l}
\mathbf{if}\;y \le -2.0912622621729367 \cdot 10^{206}:\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right) + -1 \cdot \frac{x \cdot z}{y}\right)\\

\mathbf{elif}\;y \le 6.07031039754652855 \cdot 10^{71}:\\
\;\;\;\;x + \left(\left(y \cdot z\right) \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)}\\

\mathbf{else}:\\
\;\;\;\;x + \sqrt{y} \cdot \left(\sqrt{y} \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\right)\\

\end{array}
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) {
	double VAR;
	if ((y <= -2.0912622621729367e+206)) {
		VAR = (x + (y * ((z * tanh((t / y))) + (-1.0 * ((x * z) / y)))));
	} else {
		double VAR_1;
		if ((y <= 6.070310397546529e+71)) {
			VAR_1 = (x + (((y * z) * (cbrt((tanh((t / y)) - tanh((x / y)))) * cbrt((tanh((t / y)) - tanh((x / y)))))) * cbrt((tanh((t / y)) - tanh((x / y))))));
		} else {
			VAR_1 = (x + (sqrt(y) * (sqrt(y) * (z * (tanh((t / y)) - tanh((x / y)))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.7
Target2.1
Herbie2.7
\[x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\]

Derivation

  1. Split input into 3 regimes
  2. if y < -2.0912622621729367e+206

    1. Initial program 19.1

      \[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 associate-*l*10.0

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}\]
    4. Using strategy rm
    5. Applied sub-neg10.0

      \[\leadsto x + y \cdot \left(z \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(-\tanh \left(\frac{x}{y}\right)\right)\right)}\right)\]
    6. Applied distribute-lft-in10.0

      \[\leadsto x + y \cdot \color{blue}{\left(z \cdot \tanh \left(\frac{t}{y}\right) + z \cdot \left(-\tanh \left(\frac{x}{y}\right)\right)\right)}\]
    7. Taylor expanded around inf 8.3

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

    if -2.0912622621729367e+206 < y < 6.070310397546529e+71

    1. Initial program 1.4

      \[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-cbrt1.6

      \[\leadsto x + \left(y \cdot z\right) \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)}\]
    4. Applied associate-*r*1.6

      \[\leadsto x + \color{blue}{\left(\left(y \cdot z\right) \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)}}\]

    if 6.070310397546529e+71 < y

    1. Initial program 13.0

      \[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 associate-*l*5.4

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt5.5

      \[\leadsto x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\]
    6. Applied associate-*l*5.5

      \[\leadsto x + \color{blue}{\sqrt{y} \cdot \left(\sqrt{y} \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.0912622621729367 \cdot 10^{206}:\\ \;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right) + -1 \cdot \frac{x \cdot z}{y}\right)\\ \mathbf{elif}\;y \le 6.07031039754652855 \cdot 10^{71}:\\ \;\;\;\;x + \left(\left(y \cdot z\right) \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)}\\ \mathbf{else}:\\ \;\;\;\;x + \sqrt{y} \cdot \left(\sqrt{y} \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\right)\\ \end{array}\]

Reproduce

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