Average Error: 2.8 → 0.4
Time: 4.9s
Precision: binary64
Cost: 1218
\[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -215.97089423619695:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 3737532892318.573:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\begin{array}{l}
\mathbf{if}\;z \leq -215.97089423619695:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;z \leq 3737532892318.573:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - 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
 (if (<= z -215.97089423619695)
   (+ x (/ -1.0 x))
   (if (<= z 3737532892318.573) (+ x (/ y (- 1.1283791670955126 (* 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 tmp;
	if (z <= -215.97089423619695) {
		tmp = x + (-1.0 / x);
	} else if (z <= 3737532892318.573) {
		tmp = x + (y / (1.1283791670955126 - (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}\]

Alternatives

Alternative 1
Error11.7
Cost641
\[\begin{array}{l} \mathbf{if}\;z \leq -2.866757434221824 \cdot 10^{-116}:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 2
Error19.7
Cost64
\[x\]
Alternative 3
Error61.7
Cost64
\[-1\]
Alternative 4
Error61.8
Cost64
\[1\]

Error

Derivation

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

    1. Initial program 7.6

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

      \[\leadsto x + \color{blue}{\frac{-1}{x}}\]
    3. Simplified0.0

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

    if -215.97089423619695 < z < 3737532892318.5732

    1. Initial program 0.1

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

      \[\leadsto x + \color{blue}{\frac{y}{1.1283791670955126 - x \cdot y}}\]
    3. Simplified0.8

      \[\leadsto x + \color{blue}{\frac{y}{1.1283791670955126 - y \cdot x}}\]
    4. Simplified0.8

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

    if 3737532892318.5732 < z

    1. Initial program 3.8

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

      \[\leadsto \color{blue}{x}\]
    3. Simplified0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -215.97089423619695:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 3737532892318.573:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]

Reproduce

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