Average Error: 16.8 → 8.7
Time: 2.5m
Precision: 64
Internal Precision: 1920
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \le -5.630417899394863 \cdot 10^{-287}:\\
\;\;\;\;\left(x + y\right) - \frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{\frac{\frac{a - t}{y}}{\sqrt[3]{z - t}}}\\
\mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \le 7.38922058035238 \cdot 10^{-171}:\\
\;\;\;\;\frac{z \cdot y}{t} + x\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - \frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{\frac{\frac{a - t}{y}}{\sqrt[3]{z - t}}}\\
\end{array}\]
Target
| Original | 16.8 |
|---|
| Target | 8.9 |
|---|
| Herbie | 8.7 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.3664970889390727 \cdot 10^{-07}:\\
\;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
\mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
\end{array}\]
Derivation
- Split input into 3 regimes
if (- (+ x y) (/ (* (- z t) y) (- a t))) < -5.630417899394863e-287
Initial program 12.7
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
- Using strategy
rm Applied associate-/l*7.5
\[\leadsto \left(x + y\right) - \color{blue}{\frac{z - t}{\frac{a - t}{y}}}\]
- Using strategy
rm Applied add-cube-cbrt7.7
\[\leadsto \left(x + y\right) - \frac{\color{blue}{\left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right) \cdot \sqrt[3]{z - t}}}{\frac{a - t}{y}}\]
Applied associate-/l*7.7
\[\leadsto \left(x + y\right) - \color{blue}{\frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{\frac{\frac{a - t}{y}}{\sqrt[3]{z - t}}}}\]
if -5.630417899394863e-287 < (- (+ x y) (/ (* (- z t) y) (- a t))) < 7.38922058035238e-171
Initial program 54.6
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
Taylor expanded around inf 16.5
\[\leadsto \color{blue}{\frac{z \cdot y}{t} + x}\]
if 7.38922058035238e-171 < (- (+ x y) (/ (* (- z t) y) (- a t)))
Initial program 12.9
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
- Using strategy
rm Applied associate-/l*8.0
\[\leadsto \left(x + y\right) - \color{blue}{\frac{z - t}{\frac{a - t}{y}}}\]
- Using strategy
rm Applied add-cube-cbrt8.2
\[\leadsto \left(x + y\right) - \frac{\color{blue}{\left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right) \cdot \sqrt[3]{z - t}}}{\frac{a - t}{y}}\]
Applied associate-/l*8.2
\[\leadsto \left(x + y\right) - \color{blue}{\frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{\frac{\frac{a - t}{y}}{\sqrt[3]{z - t}}}}\]
- 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, B"
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-07) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))