Average Error: 2.8 → 2.2
Time: 2.8s
Precision: 64
\[x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y} \le 3.06294570394881 \cdot 10^{61}:\\ \;\;\;\;x + \frac{1}{\frac{1.12837916709551256 \cdot e^{z} - x \cdot y}{y}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{x}\\ \end{array}\]
x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}
\begin{array}{l}
\mathbf{if}\;x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y} \le 3.06294570394881 \cdot 10^{61}:\\
\;\;\;\;x + \frac{1}{\frac{1.12837916709551256 \cdot e^{z} - x \cdot y}{y}}\\

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

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

Derivation

  1. Split input into 2 regimes
  2. if (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))) < 3.06294570394881e+61

    1. Initial program 1.3

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

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

    if 3.06294570394881e+61 < (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))

    1. Initial program 6.4

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

      \[\leadsto \color{blue}{x - \frac{1}{x}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y} \le 3.06294570394881 \cdot 10^{61}:\\ \;\;\;\;x + \frac{1}{\frac{1.12837916709551256 \cdot e^{z} - x \cdot y}{y}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{x}\\ \end{array}\]

Reproduce

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

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

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