Average Error: 2.8 → 1.2
Time: 12.3s
Precision: 64
\[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;e^{z} \le 6.9432478850086 \cdot 10^{-310}:\\ \;\;\;\;x - \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\sqrt{e^{z} \cdot 1.1283791670955126} \cdot \sqrt{e^{z} \cdot 1.1283791670955126} - x \cdot y}\\ \end{array}\]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\begin{array}{l}
\mathbf{if}\;e^{z} \le 6.9432478850086 \cdot 10^{-310}:\\
\;\;\;\;x - \frac{1}{x}\\

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

\end{array}
double f(double x, double y, double z) {
        double r19465228 = x;
        double r19465229 = y;
        double r19465230 = 1.1283791670955126;
        double r19465231 = z;
        double r19465232 = exp(r19465231);
        double r19465233 = r19465230 * r19465232;
        double r19465234 = r19465228 * r19465229;
        double r19465235 = r19465233 - r19465234;
        double r19465236 = r19465229 / r19465235;
        double r19465237 = r19465228 + r19465236;
        return r19465237;
}

double f(double x, double y, double z) {
        double r19465238 = z;
        double r19465239 = exp(r19465238);
        double r19465240 = 6.9432478850086e-310;
        bool r19465241 = r19465239 <= r19465240;
        double r19465242 = x;
        double r19465243 = 1.0;
        double r19465244 = r19465243 / r19465242;
        double r19465245 = r19465242 - r19465244;
        double r19465246 = y;
        double r19465247 = 1.1283791670955126;
        double r19465248 = r19465239 * r19465247;
        double r19465249 = sqrt(r19465248);
        double r19465250 = r19465249 * r19465249;
        double r19465251 = r19465242 * r19465246;
        double r19465252 = r19465250 - r19465251;
        double r19465253 = r19465246 / r19465252;
        double r19465254 = r19465242 + r19465253;
        double r19465255 = r19465241 ? r19465245 : r19465254;
        return r19465255;
}

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.2
\[x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x}\]

Derivation

  1. Split input into 2 regimes
  2. if (exp z) < 6.9432478850086e-310

    1. Initial program 6.9

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

      \[\leadsto \color{blue}{x - \frac{1}{x}}\]

    if 6.9432478850086e-310 < (exp z)

    1. Initial program 1.4

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt1.6

      \[\leadsto x + \frac{y}{\color{blue}{\sqrt{1.1283791670955126 \cdot e^{z}} \cdot \sqrt{1.1283791670955126 \cdot e^{z}}} - x \cdot y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.2

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

Reproduce

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