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

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

\end{array}
double f(double x, double y, double z) {
        double r16203556 = x;
        double r16203557 = y;
        double r16203558 = z;
        double r16203559 = r16203558 + r16203557;
        double r16203560 = r16203557 / r16203559;
        double r16203561 = log(r16203560);
        double r16203562 = r16203557 * r16203561;
        double r16203563 = exp(r16203562);
        double r16203564 = r16203563 / r16203557;
        double r16203565 = r16203556 + r16203564;
        return r16203565;
}

double f(double x, double y, double z) {
        double r16203566 = y;
        double r16203567 = 6.291575122955908e-19;
        bool r16203568 = r16203566 <= r16203567;
        double r16203569 = x;
        double r16203570 = 1.0;
        double r16203571 = r16203570 / r16203566;
        double r16203572 = r16203569 + r16203571;
        double r16203573 = z;
        double r16203574 = -r16203573;
        double r16203575 = exp(r16203574);
        double r16203576 = r16203575 / r16203566;
        double r16203577 = sqrt(r16203576);
        double r16203578 = r16203577 * r16203577;
        double r16203579 = r16203569 + r16203578;
        double r16203580 = r16203568 ? r16203572 : r16203579;
        return r16203580;
}

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.0
Target1.0
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 < 6.291575122955908e-19

    1. Initial program 7.8

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

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

    if 6.291575122955908e-19 < y

    1. Initial program 2.0

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

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

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

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

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

Reproduce

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