Average Error: 4.6 → 1.3
Time: 6.4min
Precision: binary64
Cost: 46977
\[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 1.7476310987367465 \cdot 10^{+306}:\\ \;\;\;\;x + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(z \cdot \left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \sqrt[3]{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\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 1.7476310987367465 \cdot 10^{+306}:\\
\;\;\;\;x + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(z \cdot \left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \sqrt[3]{y}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\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 (<=
      (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))
      1.7476310987367465e+306)
   (+
    x
    (*
     (* (cbrt y) (cbrt y))
     (* z (* (- (tanh (/ t y)) (tanh (/ x y))) (cbrt y)))))
   (* z (- t x))))
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 tmp;
	if ((x + ((y * z) * (tanh(t / y) - tanh(x / y)))) <= 1.7476310987367465e+306) {
		tmp = x + ((cbrt(y) * cbrt(y)) * (z * ((tanh(t / y) - tanh(x / y)) * cbrt(y))));
	} else {
		tmp = z * (t - x);
	}
	return tmp;
}

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.6
Target1.9
Herbie1.3
\[x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\]

Alternatives

Alternative 1
Error1.9
Cost13632
\[x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\]
Alternative 2
Error8.4
Cost7874
\[\begin{array}{l} \mathbf{if}\;t \leq -1.3630582602303108 \cdot 10^{-59}:\\ \;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\ \mathbf{elif}\;t \leq 8.739433096093365 \cdot 10^{-72}:\\ \;\;\;\;x + y \cdot \left(z \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right)\\ \end{array}\]
Alternative 3
Error9.1
Cost7304
\[\begin{array}{l} \mathbf{if}\;t \leq -9.580434192572051 \cdot 10^{-184} \lor \neg \left(t \leq 1.8688078009870105 \cdot 10^{-87}\right):\\ \;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(z \cdot \tanh \left(\frac{x}{y}\right)\right)\\ \end{array}\]
Alternative 4
Error14.2
Cost8260
\[\begin{array}{l} \mathbf{if}\;z \leq -1.430005452237489 \cdot 10^{+195}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 1.5248511801497334 \cdot 10^{+131}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right)\\ \mathbf{elif}\;z \leq 5.920134540830341 \cdot 10^{+181}:\\ \;\;\;\;-x \cdot z\\ \mathbf{elif}\;z \leq 2.676861688004712 \cdot 10^{+278}:\\ \;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array}\]
Alternative 5
Error10.3
Cost7304
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1580102497750653 \cdot 10^{+70} \lor \neg \left(y \leq 1.4709825709342302 \cdot 10^{+127}\right):\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\ \end{array}\]
Alternative 6
Error16.2
Cost776
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1343831560565726 \cdot 10^{+70} \lor \neg \left(y \leq 3.5724441121741096 \cdot 10^{+94}\right):\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 7
Error19.3
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1343831560565726 \cdot 10^{+70} \lor \neg \left(y \leq 5.821533672032214 \cdot 10^{+111}\right):\\ \;\;\;\;x + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 8
Error24.8
Cost1861
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0937184145414883 \cdot 10^{+194}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq -9.086738134324117 \cdot 10^{+121}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -5.945536235585102 \cdot 10^{+84}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 3.721256833114891 \cdot 10^{+128}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.920134540830341 \cdot 10^{+181}:\\ \;\;\;\;-x \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 9
Error21.7
Cost962
\[\begin{array}{l} \mathbf{if}\;y \leq -2.172621173459247 \cdot 10^{-28}:\\ \;\;\;\;x - x \cdot z\\ \mathbf{elif}\;y \leq 2.5909083992636173 \cdot 10^{+94}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array}\]
Alternative 10
Error21.6
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -3.7941112927548634 \cdot 10^{-23} \lor \neg \left(y \leq 3.058300935169148 \cdot 10^{+96}\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 11
Error23.6
Cost834
\[\begin{array}{l} \mathbf{if}\;x \leq -1.0765087018210958 \cdot 10^{-215}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.3071822412568377 \cdot 10^{-209}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 12
Error23.9
Cost64
\[x\]

Error

Time

Derivation

  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.74763109873674648e306

    1. Initial program 2.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*_binary64_109311.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-neg_binary64_109831.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-rgt-in_binary64_109401.0

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

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

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

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

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

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

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

    if 1.74763109873674648e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 61.5

      \[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 3.5

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

      \[\leadsto x + \color{blue}{z \cdot \left(t - x\right)}\]
    4. Taylor expanded around inf 4.4

      \[\leadsto \color{blue}{\left(t - x\right) \cdot z}\]
    5. Simplified4.4

      \[\leadsto \color{blue}{z \cdot \left(t - x\right)}\]
    6. Simplified4.4

      \[\leadsto \color{blue}{z \cdot \left(t - x\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.3

    \[\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 1.7476310987367465 \cdot 10^{+306}:\\ \;\;\;\;x + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(z \cdot \left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \sqrt[3]{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array}\]

Reproduce

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