Average Error: 4.6 → 1.3
Time: 6.4min
Precision: binary64
Cost: 46977
Math TeX FPCore C \[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;
}
Try it out Enter valid numbers for all inputs
Target Original 4.6 Target 1.9 Herbie 1.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 Error 1.9 Cost 13632
\[x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\]
Alternative 2 Error 8.4 Cost 7874
\[\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 Error 9.1 Cost 7304
\[\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 Error 14.2 Cost 8260
\[\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 Error 10.3 Cost 7304
\[\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 Error 16.2 Cost 776
\[\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 Error 19.3 Cost 648
\[\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 Error 24.8 Cost 1861
\[\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 Error 21.7 Cost 962
\[\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 Error 21.6 Cost 648
\[\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 Error 23.6 Cost 834
\[\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 Error 23.9 Cost 64
\[x\]
Error Time Derivation Split input into 2 regimes if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.74763109873674648e306 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)\]
Using strategy rm Applied associate-*l*_binary64_10931 1.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)}\]
Using strategy rm Applied sub-neg_binary64_10983 1.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)\]
Applied distribute-rgt-in_binary64_10940 1.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)}\]
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)\]
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)\]
Using strategy rm Applied add-cube-cbrt_binary64_11025 1.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)\]
Applied associate-*l*_binary64_10931 1.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)}\]
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)}\]
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))))) 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)\]
Taylor expanded around inf 3.5
\[\leadsto x + \color{blue}{\left(t - x\right) \cdot z}\]
Simplified3.5
\[\leadsto x + \color{blue}{z \cdot \left(t - x\right)}\]
Taylor expanded around inf 4.4
\[\leadsto \color{blue}{\left(t - x\right) \cdot z}\]
Simplified4.4
\[\leadsto \color{blue}{z \cdot \left(t - x\right)}\]
Simplified4.4
\[\leadsto \color{blue}{z \cdot \left(t - x\right)}\]
Recombined 2 regimes into one program. 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))))))