Average Error: 5.9 → 0.3
Time: 7.9s
Precision: 64
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.86604521535774063 \cdot 10^{122} \lor \neg \left(y \le 0.0042390669371441449\right):\\ \;\;\;\;x + \frac{e^{-1 \cdot z}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{e^{y \cdot 0}}{y}\\ \end{array}\]
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\begin{array}{l}
\mathbf{if}\;y \le -3.86604521535774063 \cdot 10^{122} \lor \neg \left(y \le 0.0042390669371441449\right):\\
\;\;\;\;x + \frac{e^{-1 \cdot z}}{y}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{e^{y \cdot 0}}{y}\\

\end{array}
double f(double x, double y, double z) {
        double r462605 = x;
        double r462606 = y;
        double r462607 = z;
        double r462608 = r462607 + r462606;
        double r462609 = r462606 / r462608;
        double r462610 = log(r462609);
        double r462611 = r462606 * r462610;
        double r462612 = exp(r462611);
        double r462613 = r462612 / r462606;
        double r462614 = r462605 + r462613;
        return r462614;
}

double f(double x, double y, double z) {
        double r462615 = y;
        double r462616 = -3.8660452153577406e+122;
        bool r462617 = r462615 <= r462616;
        double r462618 = 0.004239066937144145;
        bool r462619 = r462615 <= r462618;
        double r462620 = !r462619;
        bool r462621 = r462617 || r462620;
        double r462622 = x;
        double r462623 = -1.0;
        double r462624 = z;
        double r462625 = r462623 * r462624;
        double r462626 = exp(r462625);
        double r462627 = r462626 / r462615;
        double r462628 = r462622 + r462627;
        double r462629 = 0.0;
        double r462630 = r462615 * r462629;
        double r462631 = exp(r462630);
        double r462632 = r462631 / r462615;
        double r462633 = r462622 + r462632;
        double r462634 = r462621 ? r462628 : r462633;
        return r462634;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.9
Target1.0
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z + y} \lt 7.1154157598 \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

  1. Split input into 2 regimes
  2. if y < -3.8660452153577406e+122 or 0.004239066937144145 < y

    1. Initial program 1.9

      \[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
    2. Taylor expanded around inf 0.1

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

    if -3.8660452153577406e+122 < y < 0.004239066937144145

    1. Initial program 9.2

      \[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
    2. Taylor expanded around inf 0.6

      \[\leadsto x + \frac{e^{y \cdot \color{blue}{0}}}{y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -3.86604521535774063 \cdot 10^{122} \lor \neg \left(y \le 0.0042390669371441449\right):\\ \;\;\;\;x + \frac{e^{-1 \cdot z}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{e^{y \cdot 0}}{y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020039 +o rules:numerics
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
  :precision binary64

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