Average Error: 10.8 → 1.7
Time: 13.8s
Precision: binary64
Cost: 1032
Math TeX FPCore C \[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.266354716065063 \cdot 10^{-227} \lor \neg \left(x \leq 9.434183570764376 \cdot 10^{-09}\right):\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t}}\\
\end{array}\]
x + \frac{\left(y - z\right) \cdot t}{a - z} ↓
\begin{array}{l}
\mathbf{if}\;x \leq 1.266354716065063 \cdot 10^{-227} \lor \neg \left(x \leq 9.434183570764376 \cdot 10^{-09}\right):\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t}}\\
\end{array} (FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z)))) ↓
(FPCore (x y z t a)
:precision binary64
(if (or (<= x 1.266354716065063e-227) (not (<= x 9.434183570764376e-09)))
(+ x (* (/ (- y z) (- a z)) t))
(+ x (/ (- y z) (/ (- a z) t))))) double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
↓
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= 1.266354716065063e-227) || !(x <= 9.434183570764376e-09)) {
tmp = x + (((y - z) / (a - z)) * t);
} else {
tmp = x + ((y - z) / ((a - z) / t));
}
return tmp;
}
Try it out Enter valid numbers for all inputs
Target Original 10.8 Target 0.6 Herbie 1.7
\[\begin{array}{l}
\mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot t\\
\mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot t\\
\end{array}\]
Alternatives Alternative 1 Error 1.2 Cost 40128
\[x + \frac{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{\sqrt[3]{y - z}}{\frac{\sqrt[3]{a - z}}{t}}\]
Alternative 2 Error 0.5 Cost 1032
\[\begin{array}{l}
\mathbf{if}\;t \leq -2.607906820722103 \cdot 10^{+20} \lor \neg \left(t \leq 4.5875175130816466 \cdot 10^{-82}\right):\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\end{array}\]
Alternative 3 Error 1.5 Cost 1032
\[\begin{array}{l}
\mathbf{if}\;t \leq -9.810270338854375 \cdot 10^{-119} \lor \neg \left(t \leq 2.121227199050854 \cdot 10^{-277}\right):\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a - z}\\
\end{array}\]
Alternative 4 Error 10.9 Cost 2181
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.269628994657719 \cdot 10^{+87}:\\
\;\;\;\;x - \frac{y - z}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq -1.8891242327213466 \cdot 10^{-49}:\\
\;\;\;\;x - z \cdot \frac{t}{a - z}\\
\mathbf{elif}\;z \leq 2.9658245924063643 \cdot 10^{-104}:\\
\;\;\;\;x + \frac{y}{\frac{a - z}{t}}\\
\mathbf{elif}\;z \leq 1.7171850962601488 \cdot 10^{-47}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{elif}\;z \leq 2.7399348652501344 \cdot 10^{+51}:\\
\;\;\;\;x + \frac{y \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}\]
Alternative 5 Error 10.9 Cost 2181
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.3744400148381077 \cdot 10^{+87}:\\
\;\;\;\;x - \frac{y - z}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq -2.993230862827396 \cdot 10^{-49}:\\
\;\;\;\;x - z \cdot \frac{t}{a - z}\\
\mathbf{elif}\;z \leq 2.9658245924063643 \cdot 10^{-104}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\mathbf{elif}\;z \leq 1.7171850962601488 \cdot 10^{-47}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{elif}\;z \leq 1.6915671475104914 \cdot 10^{+52}:\\
\;\;\;\;x + \frac{y \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}\]
Alternative 6 Error 10.6 Cost 1539
\[\begin{array}{l}
\mathbf{if}\;z \leq -5.5916010666957924 \cdot 10^{+87}:\\
\;\;\;\;x - \frac{y - z}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq -3.0829907836386377 \cdot 10^{-50}:\\
\;\;\;\;x - z \cdot \frac{t}{a - z}\\
\mathbf{elif}\;z \leq 4.005831574744566 \cdot 10^{+50}:\\
\;\;\;\;x + \frac{y \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}\]
Alternative 7 Error 12.5 Cost 1860
\[\begin{array}{l}
\mathbf{if}\;a \leq -1.7810524236303283 \cdot 10^{+51}:\\
\;\;\;\;x + \frac{y - z}{\frac{a}{t}}\\
\mathbf{elif}\;a \leq -220.647905604936:\\
\;\;\;\;x - z \cdot \frac{t}{a - z}\\
\mathbf{elif}\;a \leq -3.196925398238006 \cdot 10^{-93}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;a \leq 3.0339013843065053 \cdot 10^{-09}:\\
\;\;\;\;x - \frac{y - z}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\frac{a}{t}}\\
\end{array}\]
Alternative 8 Error 12.8 Cost 1860
\[\begin{array}{l}
\mathbf{if}\;a \leq -5.665548523982956 \cdot 10^{+45}:\\
\;\;\;\;x + \frac{y - z}{\frac{a}{t}}\\
\mathbf{elif}\;a \leq -144.80765736241221:\\
\;\;\;\;x - \frac{y - z}{\frac{z}{t}}\\
\mathbf{elif}\;a \leq -3.196925398238006 \cdot 10^{-93}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;a \leq 1.8481797992319505 \cdot 10^{-09}:\\
\;\;\;\;x - \frac{y - z}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\frac{a}{t}}\\
\end{array}\]
Alternative 9 Error 15.0 Cost 1860
\[\begin{array}{l}
\mathbf{if}\;a \leq -7.205370870232716 \cdot 10^{+45}:\\
\;\;\;\;x + \frac{y - z}{\frac{a}{t}}\\
\mathbf{elif}\;a \leq -226979239.8244441:\\
\;\;\;\;x + t\\
\mathbf{elif}\;a \leq -4.219313419649227 \cdot 10^{-94}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;a \leq 4.666143669536909 \cdot 10^{+34}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\frac{a}{t}}\\
\end{array}\]
Alternative 10 Error 14.2 Cost 776
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.539804671575186 \cdot 10^{-41} \lor \neg \left(z \leq 3.8392687687523886 \cdot 10^{+50}\right):\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}\]
Alternative 11 Error 19.0 Cost 1041
\[\begin{array}{l}
\mathbf{if}\;a \leq -4.623624693564985 \cdot 10^{+150} \lor \neg \left(a \leq -7928054331.279097 \lor \neg \left(a \leq -4.640645079994026 \cdot 10^{-97}\right) \land a \leq 4.082774562727311 \cdot 10^{+33}\right):\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}\]
Alternative 12 Error 22.9 Cost 908
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.1708911965137315 \cdot 10^{+128} \lor \neg \left(y \leq -4.471136920446894 \cdot 10^{+69}\right) \land y \leq 7.609833274098096 \cdot 10^{+170}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t}{a - z}\\
\end{array}\]
Alternative 13 Error 20.9 Cost 513
\[\begin{array}{l}
\mathbf{if}\;a \leq -8.231696246658259 \cdot 10^{+140}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}\]
Alternative 14 Error 28.7 Cost 64
\[x\]
Alternative 15 Error 61.9 Cost 64
\[-1\]
Alternative 16 Error 61.8 Cost 64
\[1\]
Error Derivation Split input into 2 regimes if x < 1.2663547160650629e-227 or 9.4341835707643759e-9 < x Initial program 10.8
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
Using strategy rm Applied associate-/l*_binary64_17073 2.9
\[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t}}}\]
Using strategy rm Applied associate-/r/_binary64_17074 1.2
\[\leadsto x + \color{blue}{\frac{y - z}{a - z} \cdot t}\]
Simplified1.2
\[\leadsto \color{blue}{x + \frac{y - z}{a - z} \cdot t}\]
if 1.2663547160650629e-227 < x < 9.4341835707643759e-9 Initial program 10.5
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
Using strategy rm Applied associate-/l*_binary64_17073 3.8
\[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t}}}\]
Simplified3.8
\[\leadsto \color{blue}{x + \frac{y - z}{\frac{a - z}{t}}}\]
Recombined 2 regimes into one program. Final simplification1.7
\[\leadsto \begin{array}{l}
\mathbf{if}\;x \leq 1.266354716065063 \cdot 10^{-227} \lor \neg \left(x \leq 9.434183570764376 \cdot 10^{-09}\right):\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t}}\\
\end{array}\]
Reproduce herbie shell --seed 2021044
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))
(+ x (/ (* (- y z) t) (- a z))))