Average Error: 2.8 → 1.1
Time: 2.7s
Precision: binary64
\[x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;z \le -4.58922605112952682 \cdot 10^{33}:\\ \;\;\;\;x - \frac{1}{x}\\ \mathbf{elif}\;z \le 1.13882521185942434 \cdot 10^{108}:\\ \;\;\;\;x + \frac{1}{\frac{1.12837916709551256 \cdot e^{z} - x \cdot y}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{1.12837916709551256 \cdot z + \left(0.564189583547756279 \cdot {z}^{2} + 1.12837916709551256\right)}\\ \end{array}\]
x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}
\begin{array}{l}
\mathbf{if}\;z \le -4.58922605112952682 \cdot 10^{33}:\\
\;\;\;\;x - \frac{1}{x}\\

\mathbf{elif}\;z \le 1.13882521185942434 \cdot 10^{108}:\\
\;\;\;\;x + \frac{1}{\frac{1.12837916709551256 \cdot e^{z} - x \cdot y}{y}}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{1.12837916709551256 \cdot z + \left(0.564189583547756279 \cdot {z}^{2} + 1.12837916709551256\right)}\\

\end{array}
double code(double x, double y, double z) {
	return ((double) (x + ((double) (y / ((double) (((double) (1.1283791670955126 * ((double) exp(z)))) - ((double) (x * y))))))));
}
double code(double x, double y, double z) {
	double VAR;
	if ((z <= -4.589226051129527e+33)) {
		VAR = ((double) (x - ((double) (1.0 / x))));
	} else {
		double VAR_1;
		if ((z <= 1.1388252118594243e+108)) {
			VAR_1 = ((double) (x + ((double) (1.0 / ((double) (((double) (((double) (1.1283791670955126 * ((double) exp(z)))) - ((double) (x * y)))) / y))))));
		} else {
			VAR_1 = ((double) (x + ((double) (y / ((double) (((double) (1.1283791670955126 * z)) + ((double) (((double) (0.5641895835477563 * ((double) pow(z, 2.0)))) + 1.1283791670955126))))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.12837916709551256}{y} \cdot e^{z} - x}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -4.58922605112952682e33

    1. Initial program 7.1

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

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

    if -4.58922605112952682e33 < z < 1.13882521185942434e108

    1. Initial program 1.0

      \[x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}\]
    2. Using strategy rm
    3. Applied clear-num1.0

      \[\leadsto x + \color{blue}{\frac{1}{\frac{1.12837916709551256 \cdot e^{z} - x \cdot y}{y}}}\]

    if 1.13882521185942434e108 < z

    1. Initial program 3.7

      \[x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}\]
    2. Taylor expanded around 0 2.4

      \[\leadsto x + \frac{y}{\color{blue}{1.12837916709551256 \cdot z + \left(0.564189583547756279 \cdot {z}^{2} + 1.12837916709551256\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -4.58922605112952682 \cdot 10^{33}:\\ \;\;\;\;x - \frac{1}{x}\\ \mathbf{elif}\;z \le 1.13882521185942434 \cdot 10^{108}:\\ \;\;\;\;x + \frac{1}{\frac{1.12837916709551256 \cdot e^{z} - x \cdot y}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{1.12837916709551256 \cdot z + \left(0.564189583547756279 \cdot {z}^{2} + 1.12837916709551256\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020161 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
  :precision binary64

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

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