Average Error: 17.0 → 1.3
Time: 38.5s
Precision: 64
Internal precision: 128
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;y \le -9.070182556111448 \cdot 10^{+26}:\\ \;\;\;\;\frac{e^{-\frac{1}{y}}}{x}\\ \mathbf{if}\;y \le 3161902.943760184:\\ \;\;\;\;\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}\\ \mathbf{if}\;y \le 4.863799357303041 \cdot 10^{+32}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)\\ \mathbf{if}\;y \le 3.6621373869794807 \cdot 10^{+53}:\\ \;\;\;\;\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Target

Original17.0
Comparison5.8
Herbie1.3
\[ \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

  1. Split input into 3 regimes.
  2. if y < -9.070182556111448e+26

    1. Initial program 41.4

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Applied simplify 41.2

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]
    3. Applied taylor 0

      \[\leadsto \frac{e^{-\frac{1}{y}}}{x}\]
    4. Taylor expanded around inf 0

      \[\leadsto \frac{\color{blue}{e^{-\frac{1}{y}}}}{x}\]

    if -9.070182556111448e+26 < y < 3161902.943760184 or 4.863799357303041e+32 < y < 3.6621373869794807e+53

    1. Initial program 2.0

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Applied simplify 2.0

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]

    if 3161902.943760184 < y < 4.863799357303041e+32 or 3.6621373869794807e+53 < y

    1. Initial program 33.3

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Applied simplify 33.2

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]
    3. Using strategy rm
    4. Applied add-log-exp 1.0

      \[\leadsto \color{blue}{\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 38.5s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1858596742 804719495 3253308135 4065321562 563671171 3966716498)'
(FPCore (x y)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, F"

  :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))