Average Error: 11.4 → 2.2
Time: 44.1s
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}:\\
\;\;\;\;\left(x \cdot \left(y - z\right)\right) \cdot \frac{1}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\
\end{array}\]
Target
| Original | 11.4 |
|---|
| Target | 2.0 |
|---|
| Herbie | 2.2 |
|---|
\[\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.6
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
- Using strategy
rm Applied div-inv5.7
\[\leadsto \color{blue}{\left(x \cdot \left(y - z\right)\right) \cdot \frac{1}{t - z}}\]
if -2.2005782380220625e-285 < z
Initial program 11.5
\[\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 +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)))