Average Error: 2.8 → 0.4
Time: 4.6s
Precision: binary64
\[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
\[\begin{array}{l} t_0 := 1.1283791670955126 \cdot e^{z}\\ \mathbf{if}\;t_0 \leq 4.251535463079424 \cdot 10^{-306}:\\ \;\;\;\;x + \frac{\sqrt[3]{-1}}{x}\\ \mathbf{elif}\;t_0 \leq 1.1283791670955152:\\ \;\;\;\;x + \frac{y}{t_0 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\begin{array}{l}
t_0 := 1.1283791670955126 \cdot e^{z}\\
\mathbf{if}\;t_0 \leq 4.251535463079424 \cdot 10^{-306}:\\
\;\;\;\;x + \frac{\sqrt[3]{-1}}{x}\\

\mathbf{elif}\;t_0 \leq 1.1283791670955152:\\
\;\;\;\;x + \frac{y}{t_0 - x \cdot y}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
(FPCore (x y z)
 :precision binary64
 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 1.1283791670955126 (exp z))))
   (if (<= t_0 4.251535463079424e-306)
     (+ x (/ (cbrt -1.0) x))
     (if (<= t_0 1.1283791670955152) (+ x (/ y (- t_0 (* x y)))) x))))
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 t_0 = 1.1283791670955126 * exp(z);
	double tmp;
	if (t_0 <= 4.251535463079424e-306) {
		tmp = x + (cbrt(-1.0) / x);
	} else if (t_0 <= 1.1283791670955152) {
		tmp = x + (y / (t_0 - (x * y)));
	} else {
		tmp = x;
	}
	return tmp;
}

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
Herbie0.4
\[x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x} \]

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 5081767996463981/4503599627370496 (exp.f64 z)) < 4.25153546307942408e-306

    1. Initial program 7.3

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

      \[\leadsto x + \color{blue}{\frac{1}{\frac{1.1283791670955126 \cdot e^{z} - x \cdot y}{y}}} \]
    4. Simplified7.3

      \[\leadsto x + \frac{1}{\color{blue}{\frac{e^{z} \cdot 1.1283791670955126 - y \cdot x}{y}}} \]
    5. Using strategy rm
    6. Applied add-cbrt-cube_binary6422.3

      \[\leadsto x + \color{blue}{\sqrt[3]{\left(\frac{1}{\frac{e^{z} \cdot 1.1283791670955126 - y \cdot x}{y}} \cdot \frac{1}{\frac{e^{z} \cdot 1.1283791670955126 - y \cdot x}{y}}\right) \cdot \frac{1}{\frac{e^{z} \cdot 1.1283791670955126 - y \cdot x}{y}}}} \]
    7. Simplified22.3

      \[\leadsto x + \sqrt[3]{\color{blue}{{\left(\frac{y}{1.1283791670955126 \cdot e^{z} - y \cdot x}\right)}^{3}}} \]
    8. Taylor expanded around -inf 0.0

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

    if 4.25153546307942408e-306 < (*.f64 5081767996463981/4503599627370496 (exp.f64 z)) < 1.12837916709551522

    1. Initial program 0.1

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

      \[\leadsto x + \color{blue}{\frac{1}{\frac{1.1283791670955126 \cdot e^{z} - x \cdot y}{y}}} \]
    4. Simplified0.1

      \[\leadsto x + \frac{1}{\color{blue}{\frac{e^{z} \cdot 1.1283791670955126 - y \cdot x}{y}}} \]
    5. Taylor expanded around inf 0.1

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

    if 1.12837916709551522 < (*.f64 5081767996463981/4503599627370496 (exp.f64 z))

    1. Initial program 3.7

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;1.1283791670955126 \cdot e^{z} \leq 4.251535463079424 \cdot 10^{-306}:\\ \;\;\;\;x + \frac{\sqrt[3]{-1}}{x}\\ \mathbf{elif}\;1.1283791670955126 \cdot e^{z} \leq 1.1283791670955152:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Reproduce

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