Average Error: 5.9 → 1.7
Time: 5.7s
Precision: 64
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le 3.60262967360523412 \cdot 10^{-171}:\\ \;\;\;\;x + \frac{e^{0}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \left|{\left(\frac{y}{z + y}\right)}^{\left(\frac{y}{2}\right)}\right| \cdot \frac{\sqrt{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}}{y}\\ \end{array}\]
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\begin{array}{l}
\mathbf{if}\;y \le 3.60262967360523412 \cdot 10^{-171}:\\
\;\;\;\;x + \frac{e^{0}}{y}\\

\mathbf{else}:\\
\;\;\;\;x + \left|{\left(\frac{y}{z + y}\right)}^{\left(\frac{y}{2}\right)}\right| \cdot \frac{\sqrt{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}}{y}\\

\end{array}
double f(double x, double y, double z) {
        double r416008 = x;
        double r416009 = y;
        double r416010 = z;
        double r416011 = r416010 + r416009;
        double r416012 = r416009 / r416011;
        double r416013 = log(r416012);
        double r416014 = r416009 * r416013;
        double r416015 = exp(r416014);
        double r416016 = r416015 / r416009;
        double r416017 = r416008 + r416016;
        return r416017;
}

double f(double x, double y, double z) {
        double r416018 = y;
        double r416019 = 3.602629673605234e-171;
        bool r416020 = r416018 <= r416019;
        double r416021 = x;
        double r416022 = 0.0;
        double r416023 = exp(r416022);
        double r416024 = r416023 / r416018;
        double r416025 = r416021 + r416024;
        double r416026 = z;
        double r416027 = r416026 + r416018;
        double r416028 = r416018 / r416027;
        double r416029 = 2.0;
        double r416030 = r416018 / r416029;
        double r416031 = pow(r416028, r416030);
        double r416032 = fabs(r416031);
        double r416033 = log(r416028);
        double r416034 = r416018 * r416033;
        double r416035 = exp(r416034);
        double r416036 = sqrt(r416035);
        double r416037 = r416036 / r416018;
        double r416038 = r416032 * r416037;
        double r416039 = r416021 + r416038;
        double r416040 = r416020 ? r416025 : r416039;
        return r416040;
}

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
Herbie1.7
\[\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.602629673605234e-171

    1. Initial program 8.6

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

      \[\leadsto x + \frac{e^{\color{blue}{0}}}{y}\]

    if 3.602629673605234e-171 < y

    1. Initial program 2.3

      \[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity2.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 3.60262967360523412 \cdot 10^{-171}:\\ \;\;\;\;x + \frac{e^{0}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \left|{\left(\frac{y}{z + y}\right)}^{\left(\frac{y}{2}\right)}\right| \cdot \frac{\sqrt{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}}{y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020065 +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)))