Average Error: 10.3 → 5.8
Time: 49.0s
Precision: 64
Internal precision: 128
\[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
⬇
\[\begin{array}{l}
\mathbf{if}\;z \le -3.526581914863459 \cdot 10^{+226}:\\
\;\;\;\;a - \frac{y}{z} \cdot \left(a - x\right)\\
\mathbf{if}\;z \le 2.8945875003433984 \cdot 10^{+181}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{a - x}{\left(1.0 + t\right) - z}\\
\mathbf{else}:\\
\;\;\;\;a - \frac{y}{z} \cdot \left(a - x\right)\\
\end{array}\]
Derivation
- Split input into 2 regimes.
-
if z < -3.526581914863459e+226 or 2.8945875003433984e+181 < z
Initial program 29.7
\[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
Applied taylor 12.7
\[\leadsto \left(\frac{y \cdot x}{z} + a\right) - \frac{y \cdot a}{z}\]
Taylor expanded around inf 12.7
\[\leadsto \color{blue}{\left(\frac{y \cdot x}{z} + a\right) - \frac{y \cdot a}{z}}\]
Applied simplify 1.3
\[\leadsto \color{blue}{a - \frac{y}{z} \cdot \left(a - x\right)}\]
if -3.526581914863459e+226 < z < 2.8945875003433984e+181
Initial program 6.0
\[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
- Using strategy
rm
Applied div-inv 6.1
\[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot \frac{1}{\left(t + 1.0\right) - z}\right)} \cdot \left(a - x\right)\]
Applied associate-*l* 6.9
\[\leadsto x + \color{blue}{\left(y - z\right) \cdot \left(\frac{1}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\right)}\]
Applied simplify 6.8
\[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{a - x}{\left(1.0 + t\right) - z}}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(3416113638 274828741 3643848846 65601646 2612331895 2426467157)'
(FPCore (x y z t a)
:name "Hakyll.Web.Tags:renderTagCloud from hakyll-4.7.2.3"
(+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x))))