Average Error: 16.8 → 9.4
Time: 2.1m
Precision: 64
Internal Precision: 1920
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
↓
\[\begin{array}{l}
\mathbf{if}\;a \le -3.3197420561768994 \cdot 10^{-165}:\\
\;\;\;\;\left(x + y\right) - \frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{1} \cdot \frac{\sqrt[3]{z - t}}{\frac{a - t}{y}}\\
\mathbf{if}\;a \le 2.1459458012784685 \cdot 10^{-239}:\\
\;\;\;\;\frac{z \cdot y}{t} + x\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) - \left(z - t\right) \cdot \frac{y}{a - t}\\
\end{array}\]
Target
| Original | 16.8 |
|---|
| Target | 8.8 |
|---|
| Herbie | 9.4 |
|---|
\[\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 a < -3.3197420561768994e-165
Initial program 15.6
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
- Using strategy
rm Applied associate-/l*9.8
\[\leadsto \left(x + y\right) - \color{blue}{\frac{z - t}{\frac{a - t}{y}}}\]
- Using strategy
rm Applied *-un-lft-identity9.8
\[\leadsto \left(x + y\right) - \frac{z - t}{\color{blue}{1 \cdot \frac{a - t}{y}}}\]
Applied add-cube-cbrt9.9
\[\leadsto \left(x + y\right) - \frac{\color{blue}{\left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right) \cdot \sqrt[3]{z - t}}}{1 \cdot \frac{a - t}{y}}\]
Applied times-frac9.9
\[\leadsto \left(x + y\right) - \color{blue}{\frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{1} \cdot \frac{\sqrt[3]{z - t}}{\frac{a - t}{y}}}\]
if -3.3197420561768994e-165 < a < 2.1459458012784685e-239
Initial program 23.7
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
Taylor expanded around inf 3.8
\[\leadsto \color{blue}{\frac{z \cdot y}{t} + x}\]
if 2.1459458012784685e-239 < a
Initial program 15.5
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
Taylor expanded around inf 15.5
\[\leadsto \left(x + y\right) - \frac{\color{blue}{z \cdot y - y \cdot t}}{a - t}\]
Applied simplify10.9
\[\leadsto \color{blue}{\left(y + x\right) - \left(z - t\right) \cdot \frac{y}{a - 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))))