Average Error: 5.8 → 0.3
Time: 53.8s
Precision: 64
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4130317597818000029242101376462356480:\\ \;\;\;\;x + \frac{e^{-z}}{y}\\ \mathbf{elif}\;y \le 6.915604877957515934322576682302050368211 \cdot 10^{-19}:\\ \;\;\;\;x + \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \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 -4130317597818000029242101376462356480:\\
\;\;\;\;x + \frac{e^{-z}}{y}\\

\mathbf{elif}\;y \le 6.915604877957515934322576682302050368211 \cdot 10^{-19}:\\
\;\;\;\;x + \frac{1}{y}\\

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

\end{array}
double f(double x, double y, double z) {
        double r22813655 = x;
        double r22813656 = y;
        double r22813657 = z;
        double r22813658 = r22813657 + r22813656;
        double r22813659 = r22813656 / r22813658;
        double r22813660 = log(r22813659);
        double r22813661 = r22813656 * r22813660;
        double r22813662 = exp(r22813661);
        double r22813663 = r22813662 / r22813656;
        double r22813664 = r22813655 + r22813663;
        return r22813664;
}

double f(double x, double y, double z) {
        double r22813665 = y;
        double r22813666 = -4.130317597818e+36;
        bool r22813667 = r22813665 <= r22813666;
        double r22813668 = x;
        double r22813669 = z;
        double r22813670 = -r22813669;
        double r22813671 = exp(r22813670);
        double r22813672 = r22813671 / r22813665;
        double r22813673 = r22813668 + r22813672;
        double r22813674 = 6.915604877957516e-19;
        bool r22813675 = r22813665 <= r22813674;
        double r22813676 = 1.0;
        double r22813677 = r22813676 / r22813665;
        double r22813678 = r22813668 + r22813677;
        double r22813679 = r22813675 ? r22813678 : r22813673;
        double r22813680 = r22813667 ? r22813673 : r22813679;
        return r22813680;
}

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.8
Target1.2
Herbie0.3
\[\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 < -4.130317597818e+36 or 6.915604877957516e-19 < y

    1. Initial program 2.3

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

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

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

    if -4.130317597818e+36 < y < 6.915604877957516e-19

    1. Initial program 9.6

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

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

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

Reproduce

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