Average Error: 2.9 → 1.2
Time: 4.9s
Precision: binary64
\[x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;e^{z} \le 4.1984075450079966 \cdot 10^{-307}:\\ \;\;\;\;x - \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\sqrt{1.12837916709551256} \cdot \left(\sqrt{1.12837916709551256} \cdot e^{z}\right) - x \cdot y}\\ \end{array}\]
x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}
\begin{array}{l}
\mathbf{if}\;e^{z} \le 4.1984075450079966 \cdot 10^{-307}:\\
\;\;\;\;x - \frac{1}{x}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\sqrt{1.12837916709551256} \cdot \left(\sqrt{1.12837916709551256} \cdot e^{z}\right) - x \cdot y}\\

\end{array}
double code(double x, double y, double z) {
	return ((double) (x + (y / ((double) (((double) (1.1283791670955126 * ((double) exp(z)))) - ((double) (x * y)))))));
}
double code(double x, double y, double z) {
	double VAR;
	if ((((double) exp(z)) <= 4.198407545007997e-307)) {
		VAR = ((double) (x - (1.0 / x)));
	} else {
		VAR = ((double) (x + (y / ((double) (((double) (((double) sqrt(1.1283791670955126)) * ((double) (((double) sqrt(1.1283791670955126)) * ((double) exp(z)))))) - ((double) (x * y)))))));
	}
	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.9
Target0.0
Herbie1.2
\[x + \frac{1}{\frac{1.12837916709551256}{y} \cdot e^{z} - x}\]

Derivation

  1. Split input into 2 regimes
  2. if (exp z) < 4.1984075450079966e-307

    1. Initial program 7.2

      \[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.1984075450079966e-307 < (exp z)

    1. Initial program 1.5

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

      \[\leadsto x + \frac{y}{\color{blue}{\left(\sqrt{1.12837916709551256} \cdot \sqrt{1.12837916709551256}\right)} \cdot e^{z} - x \cdot y}\]
    4. Applied associate-*l*1.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{z} \le 4.1984075450079966 \cdot 10^{-307}:\\ \;\;\;\;x - \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\sqrt{1.12837916709551256} \cdot \left(\sqrt{1.12837916709551256} \cdot e^{z}\right) - x \cdot y}\\ \end{array}\]

Reproduce

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