Average Error: 10.2 → 1.8
Time: 1.6m
Precision: 64
Internal Precision: 640
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;t \le -1.532784384461878 \cdot 10^{-15}:\\
\;\;\;\;x + \frac{y - z}{1} \cdot \frac{t}{a - z}\\
\mathbf{if}\;t \le 4.5861660332534916 \cdot 10^{+80}:\\
\;\;\;\;x + \left(\left(y - z\right) \cdot t\right) \cdot \frac{1}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\sqrt[3]{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t}{\sqrt[3]{a - z}}} \cdot \sqrt[3]{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t}{\sqrt[3]{a - z}}}\right) \cdot \sqrt[3]{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t}{\sqrt[3]{a - z}}}\\
\end{array}\]
Target
| Original | 10.2 |
|---|
| Target | 0.6 |
|---|
| Herbie | 1.8 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \lt -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;t \lt 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}\]
Derivation
- Split input into 3 regimes
if t < -1.532784384461878e-15
Initial program 20.0
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
- Using strategy
rm Applied *-un-lft-identity20.0
\[\leadsto x + \frac{\left(y - z\right) \cdot t}{\color{blue}{1 \cdot \left(a - z\right)}}\]
Applied times-frac3.0
\[\leadsto x + \color{blue}{\frac{y - z}{1} \cdot \frac{t}{a - z}}\]
if -1.532784384461878e-15 < t < 4.5861660332534916e+80
Initial program 1.1
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
- Using strategy
rm Applied div-inv1.1
\[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t\right) \cdot \frac{1}{a - z}}\]
if 4.5861660332534916e+80 < t
Initial program 28.1
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
- Using strategy
rm Applied add-cube-cbrt28.5
\[\leadsto x + \frac{\left(y - z\right) \cdot t}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}\]
Applied times-frac2.2
\[\leadsto x + \color{blue}{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t}{\sqrt[3]{a - z}}}\]
- Using strategy
rm Applied add-cube-cbrt2.4
\[\leadsto x + \color{blue}{\left(\sqrt[3]{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t}{\sqrt[3]{a - z}}} \cdot \sqrt[3]{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t}{\sqrt[3]{a - z}}}\right) \cdot \sqrt[3]{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t}{\sqrt[3]{a - z}}}}\]
- Recombined 3 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
: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))))