Average Error: 11.1 → 3.8
Time: 15.4s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;y \le 526918.3282767582:\\ \;\;\;\;\frac{e^{\left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)\right) \cdot x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot \left(\log \left(\frac{\left(\left(\sqrt[3]{x}\right)\right)}{\sqrt[3]{x + y}}\right) + \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)\right)}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;y \le 526918.3282767582:\\
\;\;\;\;\frac{e^{\left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)\right) \cdot x}}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\log \left(\frac{\left(\left(\sqrt[3]{x}\right)\right)}{\sqrt[3]{x + y}}\right) + \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)\right)}}{x}\\

\end{array}
double f(double x, double y) {
        double r7112470 = x;
        double r7112471 = y;
        double r7112472 = r7112470 + r7112471;
        double r7112473 = r7112470 / r7112472;
        double r7112474 = log(r7112473);
        double r7112475 = r7112470 * r7112474;
        double r7112476 = exp(r7112475);
        double r7112477 = r7112476 / r7112470;
        return r7112477;
}

double f(double x, double y) {
        double r7112478 = y;
        double r7112479 = 526918.3282767582;
        bool r7112480 = r7112478 <= r7112479;
        double r7112481 = x;
        double r7112482 = cbrt(r7112481);
        double r7112483 = r7112481 + r7112478;
        double r7112484 = cbrt(r7112483);
        double r7112485 = r7112482 / r7112484;
        double r7112486 = log(r7112485);
        double r7112487 = r7112486 + r7112486;
        double r7112488 = r7112486 + r7112487;
        double r7112489 = r7112488 * r7112481;
        double r7112490 = exp(r7112489);
        double r7112491 = r7112490 / r7112481;
        double r7112492 = /* ERROR: no posit support in C */;
        double r7112493 = /* ERROR: no posit support in C */;
        double r7112494 = r7112493 / r7112484;
        double r7112495 = log(r7112494);
        double r7112496 = r7112495 + r7112487;
        double r7112497 = r7112481 * r7112496;
        double r7112498 = exp(r7112497);
        double r7112499 = r7112498 / r7112481;
        double r7112500 = r7112480 ? r7112491 : r7112499;
        return r7112500;
}

Error

Bits error versus x

Bits error versus y

Target

Original11.1
Target7.4
Herbie3.8
\[\begin{array}{l} \mathbf{if}\;y \lt -3.7311844206647956 \cdot 10^{+94}:\\ \;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\ \mathbf{elif}\;y \lt 2.817959242728288 \cdot 10^{+37}:\\ \;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\ \mathbf{elif}\;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 2 regimes
  2. if y < 526918.3282767582

    1. Initial program 4.4

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt28.0

      \[\leadsto \frac{e^{x \cdot \log \left(\frac{x}{\color{blue}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}}\right)}}{x}\]
    4. Applied add-cube-cbrt4.4

      \[\leadsto \frac{e^{x \cdot \log \left(\frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}\right)}}{x}\]
    5. Applied times-frac4.4

      \[\leadsto \frac{e^{x \cdot \log \color{blue}{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}}}{x}\]
    6. Applied log-prod1.6

      \[\leadsto \frac{e^{x \cdot \color{blue}{\left(\log \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}}{x}\]
    7. Using strategy rm
    8. Applied times-frac1.6

      \[\leadsto \frac{e^{x \cdot \left(\log \color{blue}{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)} + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\]
    9. Applied log-prod1.0

      \[\leadsto \frac{e^{x \cdot \left(\color{blue}{\left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)} + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\]

    if 526918.3282767582 < y

    1. Initial program 33.0

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt24.4

      \[\leadsto \frac{e^{x \cdot \log \left(\frac{x}{\color{blue}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}}\right)}}{x}\]
    4. Applied add-cube-cbrt33.1

      \[\leadsto \frac{e^{x \cdot \log \left(\frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}\right)}}{x}\]
    5. Applied times-frac33.1

      \[\leadsto \frac{e^{x \cdot \log \color{blue}{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}}}{x}\]
    6. Applied log-prod23.8

      \[\leadsto \frac{e^{x \cdot \color{blue}{\left(\log \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}}{x}\]
    7. Using strategy rm
    8. Applied times-frac23.8

      \[\leadsto \frac{e^{x \cdot \left(\log \color{blue}{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)} + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\]
    9. Applied log-prod21.6

      \[\leadsto \frac{e^{x \cdot \left(\color{blue}{\left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)} + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\]
    10. Using strategy rm
    11. Applied insert-posit1613.0

      \[\leadsto \frac{e^{x \cdot \left(\left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right) + \log \left(\frac{\color{blue}{\left(\left(\sqrt[3]{x}\right)\right)}}{\sqrt[3]{x + y}}\right)\right)}}{x}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 526918.3282767582:\\ \;\;\;\;\frac{e^{\left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)\right) \cdot x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot \left(\log \left(\frac{\left(\left(\sqrt[3]{x}\right)\right)}{\sqrt[3]{x + y}}\right) + \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)\right)}}{x}\\ \end{array}\]

Reproduce

herbie shell --seed 2019156 +o rules:numerics
(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))