Average Error: 2.9 → 1.2
Time: 43.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 r19164803 = x;
        double r19164804 = y;
        double r19164805 = 1.1283791670955126;
        double r19164806 = z;
        double r19164807 = exp(r19164806);
        double r19164808 = r19164805 * r19164807;
        double r19164809 = r19164803 * r19164804;
        double r19164810 = r19164808 - r19164809;
        double r19164811 = r19164804 / r19164810;
        double r19164812 = r19164803 + r19164811;
        return r19164812;
}

double f(double x, double y, double z) {
        double r19164813 = z;
        double r19164814 = exp(r19164813);
        double r19164815 = 6.9432478850086e-310;
        bool r19164816 = r19164814 <= r19164815;
        double r19164817 = x;
        double r19164818 = 1.0;
        double r19164819 = r19164818 / r19164817;
        double r19164820 = r19164817 - r19164819;
        double r19164821 = y;
        double r19164822 = 1.1283791670955126;
        double r19164823 = r19164814 * r19164822;
        double r19164824 = sqrt(r19164823);
        double r19164825 = r19164824 * r19164824;
        double r19164826 = r19164817 * r19164821;
        double r19164827 = r19164825 - r19164826;
        double r19164828 = r19164821 / r19164827;
        double r19164829 = r19164817 + r19164828;
        double r19164830 = r19164816 ? r19164820 : r19164829;
        return r19164830;
}

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.9
Target0.0
Herbie1.2
\[x + \frac{1.0}{\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 7.1

      \[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.5

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

      \[\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 +o rules:numerics
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"

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

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