Average Error: 6.1 → 0.1
Time: 4.3s
Precision: 64
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1116111820951900757028957439299745235337000 \lor \neg \left(y \le 1.292740669483186222166182233195286244154\right):\\ \;\;\;\;x + \sqrt{e^{-1 \cdot z}} \cdot \frac{\sqrt{e^{-1 \cdot z}}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{{\left(e^{y}\right)}^{\left(\log \left(\frac{y}{z + y}\right)\right)}}{y}\\ \end{array}\]
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\begin{array}{l}
\mathbf{if}\;y \le -1116111820951900757028957439299745235337000 \lor \neg \left(y \le 1.292740669483186222166182233195286244154\right):\\
\;\;\;\;x + \sqrt{e^{-1 \cdot z}} \cdot \frac{\sqrt{e^{-1 \cdot z}}}{y}\\

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

\end{array}
double f(double x, double y, double z) {
        double r497490 = x;
        double r497491 = y;
        double r497492 = z;
        double r497493 = r497492 + r497491;
        double r497494 = r497491 / r497493;
        double r497495 = log(r497494);
        double r497496 = r497491 * r497495;
        double r497497 = exp(r497496);
        double r497498 = r497497 / r497491;
        double r497499 = r497490 + r497498;
        return r497499;
}

double f(double x, double y, double z) {
        double r497500 = y;
        double r497501 = -1.1161118209519008e+42;
        bool r497502 = r497500 <= r497501;
        double r497503 = 1.2927406694831862;
        bool r497504 = r497500 <= r497503;
        double r497505 = !r497504;
        bool r497506 = r497502 || r497505;
        double r497507 = x;
        double r497508 = -1.0;
        double r497509 = z;
        double r497510 = r497508 * r497509;
        double r497511 = exp(r497510);
        double r497512 = sqrt(r497511);
        double r497513 = r497512 / r497500;
        double r497514 = r497512 * r497513;
        double r497515 = r497507 + r497514;
        double r497516 = exp(r497500);
        double r497517 = r497509 + r497500;
        double r497518 = r497500 / r497517;
        double r497519 = log(r497518);
        double r497520 = pow(r497516, r497519);
        double r497521 = r497520 / r497500;
        double r497522 = r497507 + r497521;
        double r497523 = r497506 ? r497515 : r497522;
        return r497523;
}

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

Original6.1
Target1.3
Herbie0.1
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z + y} \lt 7.115415759790762719541517221498726780517 \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 < -1.1161118209519008e+42 or 1.2927406694831862 < y

    1. Initial program 2.4

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

      \[\leadsto x + \frac{\color{blue}{e^{-1 \cdot z}}}{y}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity0.0

      \[\leadsto x + \frac{e^{-1 \cdot z}}{\color{blue}{1 \cdot y}}\]
    5. Applied add-sqr-sqrt0.0

      \[\leadsto x + \frac{\color{blue}{\sqrt{e^{-1 \cdot z}} \cdot \sqrt{e^{-1 \cdot z}}}}{1 \cdot y}\]
    6. Applied times-frac0.0

      \[\leadsto x + \color{blue}{\frac{\sqrt{e^{-1 \cdot z}}}{1} \cdot \frac{\sqrt{e^{-1 \cdot z}}}{y}}\]
    7. Simplified0.0

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

    if -1.1161118209519008e+42 < y < 1.2927406694831862

    1. Initial program 9.8

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

      \[\leadsto x + \frac{e^{\color{blue}{\log \left(e^{y}\right)} \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
    4. Applied exp-to-pow0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1116111820951900757028957439299745235337000 \lor \neg \left(y \le 1.292740669483186222166182233195286244154\right):\\ \;\;\;\;x + \sqrt{e^{-1 \cdot z}} \cdot \frac{\sqrt{e^{-1 \cdot z}}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{{\left(e^{y}\right)}^{\left(\log \left(\frac{y}{z + y}\right)\right)}}{y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020001 
(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)))