Average Error: 11.3 → 2.1
Time: 1.2m
Precision: 64
Internal Precision: 384
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \le -1.8904526391866433 \cdot 10^{-46}:\\
\;\;\;\;\frac{x}{1} \cdot \frac{y - z}{t - z}\\
\mathbf{if}\;z \le -2.2005782380220625 \cdot 10^{-285}:\\
\;\;\;\;\frac{1}{\frac{\frac{t - z}{y - z}}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\
\end{array}\]
Target
| Original | 11.3 |
|---|
| Target | 2.0 |
|---|
| Herbie | 2.1 |
|---|
\[\frac{x}{\frac{t - z}{y - z}}\]
Derivation
- Split input into 3 regimes
if z < -1.8904526391866433e-46
Initial program 14.6
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
- Using strategy
rm Applied *-un-lft-identity14.6
\[\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 -1.8904526391866433e-46 < z < -2.2005782380220625e-285
Initial program 5.5
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
Taylor expanded around 0 5.5
\[\leadsto \frac{\color{blue}{y \cdot x - z \cdot x}}{t - z}\]
Applied simplify4.6
\[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}}\]
- Using strategy
rm Applied clear-num5.0
\[\leadsto \color{blue}{\frac{1}{\frac{\frac{t - z}{y - z}}{x}}}\]
if -2.2005782380220625e-285 < z
Initial program 11.5
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
Taylor expanded around 0 11.5
\[\leadsto \frac{\color{blue}{y \cdot x - z \cdot x}}{t - z}\]
Applied simplify2.1
\[\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 +o reduce:binary-search
(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)))