Average Error: 17.2 → 1.2
Time: 1.2m
Precision: 64
Internal Precision: 1408
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
↓
\[\begin{array}{l}
\mathbf{if}\;y \le -1.236076699891847 \cdot 10^{+90}:\\
\;\;\;\;\frac{e^{-\frac{1}{y}}}{x}\\
\mathbf{if}\;y \le 1056507017731.9486:\\
\;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\right)\\
\end{array}\]
Target
| Original | 17.2 |
|---|
| Target | 4.5 |
|---|
| Herbie | 1.2 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \lt -3.7311844206647956 \cdot 10^{+94}:\\
\;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\
\mathbf{if}\;y \lt 2.817959242728288 \cdot 10^{+37}:\\
\;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\
\mathbf{if}\;y \lt 2.347387415166998 \cdot 10^{+178}:\\
\;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\
\end{array}\]
Derivation
- Split input into 3 regimes
if y < -1.236076699891847e+90
Initial program 46.8
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
Applied simplify46.7
\[\leadsto \color{blue}{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\]
Taylor expanded around inf 0
\[\leadsto \frac{\color{blue}{e^{-\frac{1}{y}}}}{x}\]
if -1.236076699891847e+90 < y < 1056507017731.9486
Initial program 2.0
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
Applied simplify1.7
\[\leadsto \color{blue}{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\]
if 1056507017731.9486 < y
Initial program 35.3
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
Applied simplify35.3
\[\leadsto \color{blue}{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\]
- Using strategy
rm Applied add-log-exp0.9
\[\leadsto \color{blue}{\log \left(e^{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\right)}\]
- Recombined 3 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)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, F"
:herbie-target
(if (< y -3.7311844206647956e+94) (/ (exp (/ -1 y)) x) (if (< y 2.817959242728288e+37) (/ (pow (/ x (+ y x)) x) x) (if (< y 2.347387415166998e+178) (log (exp (/ (pow (/ x (+ y x)) x) x))) (/ (exp (/ -1 y)) x))))
(/ (exp (* x (log (/ x (+ x y))))) x))