Average Error: 11.4 → 2.1
Time: 48.4s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \le -6.328658816588737 \cdot 10^{-51}:\\
\;\;\;\;\frac{x}{1} \cdot \frac{y - z}{t - z}\\
\mathbf{if}\;z \le -5.630417899394863 \cdot 10^{-287}:\\
\;\;\;\;\frac{1}{\frac{\frac{t - z}{y - z}}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\
\end{array}\]
Target
| Original | 11.4 |
|---|
| Target | 2.0 |
|---|
| Herbie | 2.1 |
|---|
\[\frac{x}{\frac{t - z}{y - z}}\]
Derivation
- Split input into 3 regimes
if z < -6.328658816588737e-51
Initial program 14.5
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
- Using strategy
rm Applied *-un-lft-identity14.5
\[\leadsto \frac{x \cdot \left(y - z\right)}{\color{blue}{1 \cdot \left(t - z\right)}}\]
Applied times-frac0.3
\[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y - z}{t - z}}\]
if -6.328658816588737e-51 < z < -5.630417899394863e-287
Initial program 5.6
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
Taylor expanded around 0 5.6
\[\leadsto \frac{\color{blue}{y \cdot x - z \cdot x}}{t - z}\]
Applied simplify4.7
\[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}}\]
- Using strategy
rm Applied clear-num5.1
\[\leadsto \color{blue}{\frac{1}{\frac{\frac{t - z}{y - z}}{x}}}\]
if -5.630417899394863e-287 < z
Initial program 11.6
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
Taylor expanded around 0 11.6
\[\leadsto \frac{\color{blue}{y \cdot x - z \cdot x}}{t - z}\]
Applied simplify2.0
\[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - 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)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:herbie-target
(/ x (/ (- t z) (- y z)))
(/ (* x (- y z)) (- t z)))