Average Error: 19.4 → 0.8
Time: 33.5s
Precision: 64
Internal precision: 128
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;\frac{y}{z + y} \le 5.3881129393563 \cdot 10^{-317}:\\
\;\;\;\;\left(\frac{1}{y} + x\right) - \frac{1}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{y}{z + y}\right)}^{y}}{y} + x\\
\end{array}\]
Target
| Original | 19.4 |
| Comparison | 2.6 |
| Herbie | 0.8 |
\[ \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)) < 5.3881129393563e-317
Initial program 59.1
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
Applied simplify 54.7
\[\leadsto \color{blue}{\frac{{\left(\frac{y}{z + y}\right)}^{y}}{y} + x}\]
Applied taylor 5.9
\[\leadsto \frac{e^{-\frac{1}{z}}}{y} + x\]
Taylor expanded around inf 5.9
\[\leadsto \frac{\color{blue}{e^{-\frac{1}{z}}}}{y} + x\]
Applied taylor 0.0
\[\leadsto \left(\frac{1}{y} + x\right) - \frac{1}{z \cdot y}\]
Taylor expanded around inf 0.0
\[\leadsto \color{blue}{\left(\frac{1}{y} + x\right) - \frac{1}{z \cdot y}}\]
if 5.3881129393563e-317 < (/ y (+ z y))
Initial program 1.1
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
Applied simplify 1.1
\[\leadsto \color{blue}{\frac{{\left(\frac{y}{z + y}\right)}^{y}}{y} + x}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(1176599356 1757141449 4072909358 2971363 2715525575 3892048116)'
(FPCore (x y z)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
: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)))