Average Error: 4.4 → 0.8
Time: 4.3s
Precision: binary64
\[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}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq -\infty \lor \neg \left(x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq 1.9072265688125544 \cdot 10^{+306}\right):\\ \;\;\;\;x + \left(z \cdot t - x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\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}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq -\infty \lor \neg \left(x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq 1.9072265688125544 \cdot 10^{+306}\right):\\
\;\;\;\;x + \left(z \cdot t - x \cdot z\right)\\

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

\end{array}
(FPCore (x y z t)
 :precision binary64
 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) (- INFINITY))
         (not
          (<=
           (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))
           1.9072265688125544e+306)))
   (+ x (- (* z t) (* x z)))
   (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
	return ((double) (x + ((double) (((double) (y * z)) * ((double) (((double) tanh((t / y))) - ((double) tanh((x / y)))))))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((((double) (x + ((double) (((double) (y * z)) * ((double) (((double) tanh((t / y))) - ((double) tanh((x / y))))))))) <= ((double) -(((double) INFINITY)))) || !(((double) (x + ((double) (((double) (y * z)) * ((double) (((double) tanh((t / y))) - ((double) tanh((x / y))))))))) <= 1.9072265688125544e+306))) {
		VAR = ((double) (x + ((double) (((double) (z * t)) - ((double) (x * z))))));
	} else {
		VAR = ((double) (x + ((double) (((double) (y * z)) * ((double) (((double) tanh((t / y))) - ((double) tanh((x / y)))))))));
	}
	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.4
Target1.9
Herbie0.8
\[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 2 regimes
  2. if (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < -inf.0 or 1.9072265688125544e306 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))

    1. Initial program 62.3

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

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

      \[\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)\]
    5. Applied distribute-lft-in13.9

      \[\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)}\]
    6. Applied distribute-lft-in16.6

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

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

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

      \[\leadsto x + \left(\color{blue}{t \cdot z} + z \cdot \left(-x\right)\right)\]
    10. Simplified3.4

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

    if -inf.0 < (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) < 1.9072265688125544e306

    1. Initial program 0.6

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq -\infty \lor \neg \left(x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq 1.9072265688125544 \cdot 10^{+306}\right):\\ \;\;\;\;x + \left(z \cdot t - x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\ \end{array}\]

Reproduce

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