Average Error: 20.1 → 0.7
Time: 1.2m
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 0.0:\\
\;\;\;\;\frac{e^{-\frac{1}{z}}}{y} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{{\left({\left(\frac{y}{z + y}\right)}^{y}\right)}^{3}}}{y} + x\\
\end{array}\]
Target
| Original | 20.1 |
|---|
| 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)) < 0.0
Initial program 59.9
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
Applied simplify55.9
\[\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 0.0 < (/ 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}\]
- Using strategy
rm Applied add-cbrt-cube1.0
\[\leadsto \frac{\color{blue}{\sqrt[3]{\left({\left(\frac{y}{y + z}\right)}^{y} \cdot {\left(\frac{y}{y + z}\right)}^{y}\right) \cdot {\left(\frac{y}{y + z}\right)}^{y}}}}{y} + x\]
Applied simplify1.0
\[\leadsto \frac{\sqrt[3]{\color{blue}{{\left({\left(\frac{y}{z + y}\right)}^{y}\right)}^{3}}}}{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 +o reduce:binary-search
(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)))