Average Error: 10.0 → 6.5
Time: 2.5m
Precision: 64
Internal Precision: 1408
\[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
↓
\[\begin{array}{l}
\mathbf{if}\;x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right) \le -4.729447263504346 \cdot 10^{-308}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{a - x}{1.0 + \left(t - z\right)}\\
\mathbf{if}\;x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right) \le 3.735682881900282 \cdot 10^{-256}:\\
\;\;\;\;a - \left(a - x\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{a - x}{1.0 + \left(t - z\right)}\\
\end{array}\]
Target
| Original | 10.0 |
|---|
| Target | 10.0 |
|---|
| Herbie | 6.5 |
|---|
\[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
Derivation
- Split input into 2 regimes
if (+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x))) < -4.729447263504346e-308 or 3.735682881900282e-256 < (+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x)))
Initial program 0.9
\[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
- Using strategy
rm Applied div-inv1.0
\[\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*2.5
\[\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 simplify2.4
\[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{a - x}{1.0 + \left(t - z\right)}}\]
if -4.729447263504346e-308 < (+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x))) < 3.735682881900282e-256
Initial program 61.2
\[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
Taylor expanded around inf 34.5
\[\leadsto \color{blue}{\left(\frac{y \cdot x}{z} + a\right) - \frac{y \cdot a}{z}}\]
Applied simplify29.4
\[\leadsto \color{blue}{a - \left(a - x\right) \cdot \frac{y}{z}}\]
- Recombined 2 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 a)
:name "Hakyll.Web.Tags:renderTagCloud from hakyll-4.7.2.3"
:herbie-target
(+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x)))
(+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x))))