Average Error: 3.0 → 0.5
Time: 14.1s
Precision: 64
\[x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y} \le -1.760267047790503409639426851947972538871 \cdot 10^{224}:\\ \;\;\;\;x - \frac{1}{x}\\ \mathbf{elif}\;x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y} \le 3.139871723518476025304133244597234031702 \cdot 10^{196}:\\ \;\;\;\;x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{x}\\ \end{array}\]
x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}
\begin{array}{l}
\mathbf{if}\;x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y} \le -1.760267047790503409639426851947972538871 \cdot 10^{224}:\\
\;\;\;\;x - \frac{1}{x}\\

\mathbf{elif}\;x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y} \le 3.139871723518476025304133244597234031702 \cdot 10^{196}:\\
\;\;\;\;x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y}\\

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

\end{array}
double f(double x, double y, double z) {
        double r19122253 = x;
        double r19122254 = y;
        double r19122255 = 1.1283791670955126;
        double r19122256 = z;
        double r19122257 = exp(r19122256);
        double r19122258 = r19122255 * r19122257;
        double r19122259 = r19122253 * r19122254;
        double r19122260 = r19122258 - r19122259;
        double r19122261 = r19122254 / r19122260;
        double r19122262 = r19122253 + r19122261;
        return r19122262;
}

double f(double x, double y, double z) {
        double r19122263 = x;
        double r19122264 = y;
        double r19122265 = z;
        double r19122266 = exp(r19122265);
        double r19122267 = 1.1283791670955126;
        double r19122268 = r19122266 * r19122267;
        double r19122269 = r19122263 * r19122264;
        double r19122270 = r19122268 - r19122269;
        double r19122271 = r19122264 / r19122270;
        double r19122272 = r19122263 + r19122271;
        double r19122273 = -1.7602670477905034e+224;
        bool r19122274 = r19122272 <= r19122273;
        double r19122275 = 1.0;
        double r19122276 = r19122275 / r19122263;
        double r19122277 = r19122263 - r19122276;
        double r19122278 = 3.139871723518476e+196;
        bool r19122279 = r19122272 <= r19122278;
        double r19122280 = r19122279 ? r19122272 : r19122277;
        double r19122281 = r19122274 ? r19122277 : r19122280;
        return r19122281;
}

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

Original3.0
Target0.1
Herbie0.5
\[x + \frac{1}{\frac{1.128379167095512558560699289955664426088}{y} \cdot e^{z} - x}\]

Derivation

  1. Split input into 2 regimes
  2. if (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))) < -1.7602670477905034e+224 or 3.139871723518476e+196 < (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))

    1. Initial program 12.2

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

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

    if -1.7602670477905034e+224 < (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))) < 3.139871723518476e+196

    1. Initial program 0.2

      \[x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y} \le -1.760267047790503409639426851947972538871 \cdot 10^{224}:\\ \;\;\;\;x - \frac{1}{x}\\ \mathbf{elif}\;x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y} \le 3.139871723518476025304133244597234031702 \cdot 10^{196}:\\ \;\;\;\;x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{x}\\ \end{array}\]

Reproduce

herbie shell --seed 2019170 +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)))))