Average Error: 2.8 → 1.1
Time: 14.3s
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 r18531177 = x;
        double r18531178 = y;
        double r18531179 = 1.1283791670955126;
        double r18531180 = z;
        double r18531181 = exp(r18531180);
        double r18531182 = r18531179 * r18531181;
        double r18531183 = r18531177 * r18531178;
        double r18531184 = r18531182 - r18531183;
        double r18531185 = r18531178 / r18531184;
        double r18531186 = r18531177 + r18531185;
        return r18531186;
}

double f(double x, double y, double z) {
        double r18531187 = x;
        double r18531188 = y;
        double r18531189 = z;
        double r18531190 = exp(r18531189);
        double r18531191 = 1.1283791670955126;
        double r18531192 = r18531190 * r18531191;
        double r18531193 = r18531187 * r18531188;
        double r18531194 = r18531192 - r18531193;
        double r18531195 = r18531188 / r18531194;
        double r18531196 = r18531187 + r18531195;
        double r18531197 = 5.241345650251777e+241;
        bool r18531198 = r18531196 <= r18531197;
        double r18531199 = 1.0;
        double r18531200 = r18531199 / r18531187;
        double r18531201 = r18531187 - r18531200;
        double r18531202 = r18531198 ? r18531196 : r18531201;
        return r18531202;
}

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)))))