Average Error: 20.0 → 0.7
Time: 1.1m
Precision: 64
Internal Precision: 1408
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{y}{z + y} \le 1.8088301588428 \cdot 10^{-317}:\\
\;\;\;\;\frac{e^{-\frac{1}{z}}}{y} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{y}{y + z}\right)}^{y}}{y} + x\\
\end{array}\]
Target
| Original | 20.0 |
|---|
| Target | 0.7 |
|---|
| Herbie | 0.7 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{y}{z + y} \lt 7.1154157597908 \cdot 10^{-315}:\\
\;\;\;\;x + \frac{e^{\frac{-1}{z}}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{e^{\log \left({\left(\frac{y}{y + z}\right)}^{y}\right)}}{y}\\
\end{array}\]
Derivation
- Split input into 2 regimes
if (/ y (+ z y)) < 1.8088301588428e-317
Initial program 59.4
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
Applied simplify55.4
\[\leadsto \color{blue}{\frac{{\left(\frac{y}{y + z}\right)}^{y}}{y} + x}\]
Taylor expanded around inf 0.0
\[\leadsto \frac{\color{blue}{e^{-\frac{1}{z}}}}{y} + x\]
if 1.8088301588428e-317 < (/ y (+ z y))
Initial program 1.0
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
Applied simplify1.0
\[\leadsto \color{blue}{\frac{{\left(\frac{y}{y + z}\right)}^{y}}{y} + x}\]
- Recombined 2 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
:herbie-target
(if (< (/ y (+ z y)) 7.1154157597908e-315) (+ x (/ (exp (/ -1 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y)))
(+ x (/ (exp (* y (log (/ y (+ z y))))) y)))