Average Error: 17.5 → 3.9
Time: 1.7m
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 1.6167012447435848 \cdot 10^{+27}:\\ \;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\ \mathbf{if}\;y \le 8.639532840636843 \cdot 10^{+182}:\\ \;\;\;\;\frac{{\left(\frac{\frac{x}{\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}}}{{y}^{\frac{-1}{3}}}\right)}^{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Target

Original17.5
Target7.0
Herbie3.9
\[\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 < -1.236076699891847e+90

    1. Initial program 46.8

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

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\]
    3. Taylor expanded around inf 0

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

    if -1.236076699891847e+90 < y < 1.6167012447435848e+27 or 8.639532840636843e+182 < y

    1. Initial program 5.3

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

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

    if 1.6167012447435848e+27 < y < 8.639532840636843e+182

    1. Initial program 35.0

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

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

      \[\leadsto \frac{{\left(\frac{x}{\color{blue}{\left(\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}\right) \cdot \sqrt[3]{y + x}}}\right)}^{x}}{x}\]
    5. Applied associate-/r*28.5

      \[\leadsto \frac{{\color{blue}{\left(\frac{\frac{x}{\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}}}{\sqrt[3]{y + x}}\right)}}^{x}}{x}\]
    6. Taylor expanded around inf 4.7

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

Runtime

Time bar (total: 1.7m)Debug log

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