Average Error: 6.1 → 0.1
Time: 4.4s
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 + \frac{1 \cdot 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 + \frac{1 \cdot 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 r480619 = x;
        double r480620 = y;
        double r480621 = z;
        double r480622 = r480621 + r480620;
        double r480623 = r480620 / r480622;
        double r480624 = log(r480623);
        double r480625 = r480620 * r480624;
        double r480626 = exp(r480625);
        double r480627 = r480626 / r480620;
        double r480628 = r480619 + r480627;
        return r480628;
}

double f(double x, double y, double z) {
        double r480629 = y;
        double r480630 = -1.1161118209519008e+42;
        bool r480631 = r480629 <= r480630;
        double r480632 = 1.2927406694831862;
        bool r480633 = r480629 <= r480632;
        double r480634 = !r480633;
        bool r480635 = r480631 || r480634;
        double r480636 = x;
        double r480637 = 1.0;
        double r480638 = -1.0;
        double r480639 = z;
        double r480640 = r480638 * r480639;
        double r480641 = exp(r480640);
        double r480642 = r480637 * r480641;
        double r480643 = r480642 / r480629;
        double r480644 = r480636 + r480643;
        double r480645 = exp(r480629);
        double r480646 = r480639 + r480629;
        double r480647 = r480629 / r480646;
        double r480648 = log(r480647);
        double r480649 = pow(r480645, r480648);
        double r480650 = r480649 / r480629;
        double r480651 = r480636 + r480650;
        double r480652 = r480635 ? r480644 : r480651;
        return r480652;
}

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. Using strategy rm
    3. Applied *-un-lft-identity2.4

      \[\leadsto x + \frac{e^{y \cdot \log \left(\frac{y}{\color{blue}{1 \cdot \left(z + y\right)}}\right)}}{y}\]
    4. Applied *-un-lft-identity2.4

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

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

      \[\leadsto x + \frac{e^{y \cdot \color{blue}{\left(\log \left(\frac{1}{1}\right) + \log \left(\frac{y}{z + y}\right)\right)}}}{y}\]
    7. Applied distribute-lft-in2.4

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

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

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

      \[\leadsto x + \frac{1 \cdot \color{blue}{{\left(\frac{y}{z + y}\right)}^{y}}}{y}\]
    11. Taylor expanded around inf 0.0

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

      \[\leadsto x + \frac{1 \cdot \color{blue}{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 + \frac{1 \cdot 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)))