Average Error: 10.2 → 1.7
Time: 1.5m
Precision: 64
Internal Precision: 640
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;t \le -124511.71005566457:\\
\;\;\;\;x + \frac{y - z}{1} \cdot \frac{t}{a - z}\\
\mathbf{if}\;t \le 1.385403597157382 \cdot 10^{+79}:\\
\;\;\;\;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.5 |
|---|
| Herbie | 1.7 |
|---|
\[\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 < -124511.71005566457
Initial program 21.4
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
- Using strategy
rm Applied *-un-lft-identity21.4
\[\leadsto x + \frac{\left(y - z\right) \cdot t}{\color{blue}{1 \cdot \left(a - z\right)}}\]
Applied times-frac3.1
\[\leadsto x + \color{blue}{\frac{y - z}{1} \cdot \frac{t}{a - z}}\]
if -124511.71005566457 < t < 1.385403597157382e+79
Initial program 1.0
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
- Using strategy
rm Applied div-inv1.0
\[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t\right) \cdot \frac{1}{a - z}}\]
if 1.385403597157382e+79 < t
Initial program 28.1
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
- Using strategy
rm Applied add-cube-cbrt28.6
\[\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.1
\[\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.3
\[\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 +o reduce:binary-search
(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))))