Average Error: 2.7 → 0.1
Time: 7.2s
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 7.106359833159424 \cdot 10^{-307}:\\ \;\;\;\;x + \frac{\sqrt[3]{-1}}{x}\\ \mathbf{elif}\;t_0 \leq 1.2022060694990226:\\ \;\;\;\;x + \frac{y}{t_0 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{t_0}\\ \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 7.106359833159424 \cdot 10^{-307}:\\
\;\;\;\;x + \frac{\sqrt[3]{-1}}{x}\\

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

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t_0}\\


\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 7.106359833159424e-307)
     (+ x (/ (cbrt -1.0) x))
     (if (<= t_0 1.2022060694990226)
       (+ x (/ y (- t_0 (* x y))))
       (+ x (/ y t_0))))))
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 <= 7.106359833159424e-307) {
		tmp = x + (cbrt(-1.0) / x);
	} else if (t_0 <= 1.2022060694990226) {
		tmp = x + (y / (t_0 - (x * y)));
	} else {
		tmp = x + (y / t_0);
	}
	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.7
Target0.1
Herbie0.1
\[x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x} \]

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 5641895835477563/5000000000000000 (exp.f64 z)) < 7.106359833159424e-307

    1. Initial program 6.9

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Simplified0.0

      \[\leadsto \color{blue}{x + \frac{-1}{\mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)}} \]
    3. Applied add-cbrt-cube_binary6420.0

      \[\leadsto x + \frac{-1}{\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right) \cdot \mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)\right) \cdot \mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)}}} \]
    4. Applied add-cbrt-cube_binary6420.0

      \[\leadsto x + \frac{\color{blue}{\sqrt[3]{\left(-1 \cdot -1\right) \cdot -1}}}{\sqrt[3]{\left(\mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right) \cdot \mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)\right) \cdot \mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)}} \]
    5. Applied cbrt-undiv_binary6420.2

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

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

    if 7.106359833159424e-307 < (*.f64 5641895835477563/5000000000000000 (exp.f64 z)) < 1.20220606949902264

    1. Initial program 0.1

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Applied +-commutative_binary640.1

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

    if 1.20220606949902264 < (*.f64 5641895835477563/5000000000000000 (exp.f64 z))

    1. Initial program 3.8

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

      \[\leadsto x + \frac{y}{\color{blue}{1.1283791670955126 \cdot e^{z}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.1

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

Reproduce

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