Average Error: 2.8 → 1.1
Time: 13.2s
Precision: 64
\[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y} \le 5.241345650251777 \cdot 10^{+241}:\\ \;\;\;\;x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{x}\\ \end{array}\]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\begin{array}{l}
\mathbf{if}\;x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y} \le 5.241345650251777 \cdot 10^{+241}:\\
\;\;\;\;x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\

\mathbf{else}:\\
\;\;\;\;x - \frac{1}{x}\\

\end{array}
double f(double x, double y, double z) {
        double r21425097 = x;
        double r21425098 = y;
        double r21425099 = 1.1283791670955126;
        double r21425100 = z;
        double r21425101 = exp(r21425100);
        double r21425102 = r21425099 * r21425101;
        double r21425103 = r21425097 * r21425098;
        double r21425104 = r21425102 - r21425103;
        double r21425105 = r21425098 / r21425104;
        double r21425106 = r21425097 + r21425105;
        return r21425106;
}

double f(double x, double y, double z) {
        double r21425107 = x;
        double r21425108 = y;
        double r21425109 = z;
        double r21425110 = exp(r21425109);
        double r21425111 = 1.1283791670955126;
        double r21425112 = r21425110 * r21425111;
        double r21425113 = r21425107 * r21425108;
        double r21425114 = r21425112 - r21425113;
        double r21425115 = r21425108 / r21425114;
        double r21425116 = r21425107 + r21425115;
        double r21425117 = 5.241345650251777e+241;
        bool r21425118 = r21425116 <= r21425117;
        double r21425119 = 1.0;
        double r21425120 = r21425119 / r21425107;
        double r21425121 = r21425107 - r21425120;
        double r21425122 = r21425118 ? r21425116 : r21425121;
        return r21425122;
}

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

Original2.8
Target0.0
Herbie1.1
\[x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x}\]

Derivation

  1. Split input into 2 regimes
  2. if (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))) < 5.241345650251777e+241

    1. Initial program 1.1

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\]
    2. Using strategy rm
    3. Applied div-inv1.3

      \[\leadsto x + \color{blue}{y \cdot \frac{1}{1.1283791670955126 \cdot e^{z} - x \cdot y}}\]
    4. Using strategy rm
    5. Applied un-div-inv1.1

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

    if 5.241345650251777e+241 < (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))

    1. Initial program 19.3

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\]
    2. Taylor expanded around inf 0.8

      \[\leadsto \color{blue}{x - \frac{1}{x}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.1

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

Reproduce

herbie shell --seed 2019163 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"

  :herbie-target
  (+ x (/ 1 (- (* (/ 1.1283791670955126 y) (exp z)) x)))

  (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))