Average Error: 5.7 → 0.8
Time: 17.2s
Precision: 64
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le 18035828.612908236682415008544921875:\\ \;\;\;\;x + \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{e^{-z}}{y}} \cdot \sqrt{\frac{e^{-z}}{y}} + x\\ \end{array}\]
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\begin{array}{l}
\mathbf{if}\;y \le 18035828.612908236682415008544921875:\\
\;\;\;\;x + \frac{1}{y}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{e^{-z}}{y}} \cdot \sqrt{\frac{e^{-z}}{y}} + x\\

\end{array}
double f(double x, double y, double z) {
        double r28850393 = x;
        double r28850394 = y;
        double r28850395 = z;
        double r28850396 = r28850395 + r28850394;
        double r28850397 = r28850394 / r28850396;
        double r28850398 = log(r28850397);
        double r28850399 = r28850394 * r28850398;
        double r28850400 = exp(r28850399);
        double r28850401 = r28850400 / r28850394;
        double r28850402 = r28850393 + r28850401;
        return r28850402;
}

double f(double x, double y, double z) {
        double r28850403 = y;
        double r28850404 = 18035828.612908237;
        bool r28850405 = r28850403 <= r28850404;
        double r28850406 = x;
        double r28850407 = 1.0;
        double r28850408 = r28850407 / r28850403;
        double r28850409 = r28850406 + r28850408;
        double r28850410 = z;
        double r28850411 = -r28850410;
        double r28850412 = exp(r28850411);
        double r28850413 = r28850412 / r28850403;
        double r28850414 = sqrt(r28850413);
        double r28850415 = r28850414 * r28850414;
        double r28850416 = r28850415 + r28850406;
        double r28850417 = r28850405 ? r28850409 : r28850416;
        return r28850417;
}

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.7
Target0.9
Herbie0.8
\[\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 < 18035828.612908237

    1. Initial program 7.4

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

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

    if 18035828.612908237 < y

    1. Initial program 1.6

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

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

      \[\leadsto \color{blue}{\frac{e^{-z}}{y} + x}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 18035828.612908236682415008544921875:\\ \;\;\;\;x + \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{e^{-z}}{y}} \cdot \sqrt{\frac{e^{-z}}{y}} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"

  :herbie-target
  (if (< (/ y (+ z y)) 7.1154157597908e-315) (+ x (/ (exp (/ -1.0 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y)))

  (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))