Average Error: 2.8 → 1.1
Time: 14.8s
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 r17322227 = x;
        double r17322228 = y;
        double r17322229 = 1.1283791670955126;
        double r17322230 = z;
        double r17322231 = exp(r17322230);
        double r17322232 = r17322229 * r17322231;
        double r17322233 = r17322227 * r17322228;
        double r17322234 = r17322232 - r17322233;
        double r17322235 = r17322228 / r17322234;
        double r17322236 = r17322227 + r17322235;
        return r17322236;
}

double f(double x, double y, double z) {
        double r17322237 = x;
        double r17322238 = y;
        double r17322239 = z;
        double r17322240 = exp(r17322239);
        double r17322241 = 1.1283791670955126;
        double r17322242 = r17322240 * r17322241;
        double r17322243 = r17322237 * r17322238;
        double r17322244 = r17322242 - r17322243;
        double r17322245 = r17322238 / r17322244;
        double r17322246 = r17322237 + r17322245;
        double r17322247 = 5.241345650251777e+241;
        bool r17322248 = r17322246 <= r17322247;
        double r17322249 = 1.0;
        double r17322250 = r17322249 / r17322237;
        double r17322251 = r17322237 - r17322250;
        double r17322252 = r17322248 ? r17322246 : r17322251;
        return r17322252;
}

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 +o rules:numerics
(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)))))