Average Error: 10.2 → 1.2
Time: 20.8s
Precision: 64
Internal precision: 128
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;z \le -1.7338791390618684 \cdot 10^{-264}:\\
\;\;\;\;x + \frac{y}{1} \cdot \frac{z - t}{z - a}\\
\mathbf{if}\;z \le 6.161869838226869 \cdot 10^{-132}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z - a} + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z - t}}\\
\end{array}\]
Target
| Original | 10.2 |
| Comparison | 1.2 |
| Herbie | 1.2 |
\[ x + \frac{y}{\frac{z - a}{z - t}} \]
Derivation
- Split input into 3 regimes.
-
if z < -1.7338791390618684e-264
Initial program 10.7
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
- Using strategy
rm
Applied *-un-lft-identity 10.7
\[\leadsto x + \frac{y \cdot \left(z - t\right)}{\color{blue}{1 \cdot \left(z - a\right)}}\]
Applied times-frac 1.1
\[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - t}{z - a}}\]
if -1.7338791390618684e-264 < z < 6.161869838226869e-132
Initial program 3.6
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
Applied taylor 3.6
\[\leadsto x + \frac{y \cdot z - t \cdot y}{z - a}\]
Taylor expanded around 0 3.6
\[\leadsto x + \frac{\color{blue}{y \cdot z - t \cdot y}}{z - a}\]
Applied simplify 3.1
\[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{y}{z - a} + x}\]
if 6.161869838226869e-132 < z
Initial program 12.8
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
- Using strategy
rm
Applied associate-/l* 0.5
\[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}}\]
- Recombined 3 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(38255788 4094469987 1763798563 1987260266 4262192505 2830448021)'
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (/ (* y (- z t)) (- z a))))