?

Average Accuracy: 95.2% → 99.9%
Time: 11.1s
Precision: binary64
Cost: 13376

?

\[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
\[x + \frac{-1}{\mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)} \]
(FPCore (x y z)
 :precision binary64
 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
(FPCore (x y z)
 :precision binary64
 (+ x (/ -1.0 (fma (exp z) (/ -1.1283791670955126 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) {
	return x + (-1.0 / fma(exp(z), (-1.1283791670955126 / y), x));
}
function code(x, y, z)
	return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))))
end
function code(x, y, z)
	return Float64(x + Float64(-1.0 / fma(exp(z), Float64(-1.1283791670955126 / y), x)))
end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x + N[(-1.0 / N[(N[Exp[z], $MachinePrecision] * N[(-1.1283791670955126 / y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
x + \frac{-1}{\mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)}

Error?

Target

Original95.2%
Target99.9%
Herbie99.9%
\[x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x} \]

Derivation?

  1. Initial program 95.2%

    \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
  2. Simplified99.9%

    \[\leadsto \color{blue}{x + \frac{-1}{\mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)}} \]
    Proof

    [Start]95.2

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

    --rgt-identity [<=]95.2

    \[ \color{blue}{\left(x - 0\right)} + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]

    associate-+l- [=>]95.2

    \[ \color{blue}{x - \left(0 - \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]

    sub-neg [=>]95.2

    \[ \color{blue}{x + \left(-\left(0 - \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)\right)} \]

    +-lft-identity [<=]95.2

    \[ x + \left(-\left(0 - \color{blue}{\left(0 + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)}\right)\right) \]

    sub0-neg [=>]95.2

    \[ x + \left(-\color{blue}{\left(-\left(0 + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)\right)}\right) \]

    neg-mul-1 [=>]95.2

    \[ x + \left(-\color{blue}{-1 \cdot \left(0 + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)}\right) \]

    distribute-lft-neg-in [=>]95.2

    \[ x + \color{blue}{\left(--1\right) \cdot \left(0 + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]

    +-lft-identity [=>]95.2

    \[ x + \left(--1\right) \cdot \color{blue}{\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]

    associate-*r/ [=>]95.2

    \[ x + \color{blue}{\frac{\left(--1\right) \cdot y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]

    sub-neg [=>]95.2

    \[ x + \frac{\left(--1\right) \cdot y}{\color{blue}{1.1283791670955126 \cdot e^{z} + \left(-x \cdot y\right)}} \]

    +-commutative [=>]95.2

    \[ x + \frac{\left(--1\right) \cdot y}{\color{blue}{\left(-x \cdot y\right) + 1.1283791670955126 \cdot e^{z}}} \]

    neg-sub0 [=>]95.2

    \[ x + \frac{\left(--1\right) \cdot y}{\color{blue}{\left(0 - x \cdot y\right)} + 1.1283791670955126 \cdot e^{z}} \]

    associate-+l- [=>]95.2

    \[ x + \frac{\left(--1\right) \cdot y}{\color{blue}{0 - \left(x \cdot y - 1.1283791670955126 \cdot e^{z}\right)}} \]

    sub0-neg [=>]95.2

    \[ x + \frac{\left(--1\right) \cdot y}{\color{blue}{-\left(x \cdot y - 1.1283791670955126 \cdot e^{z}\right)}} \]

    neg-mul-1 [=>]95.2

    \[ x + \frac{\left(--1\right) \cdot y}{\color{blue}{-1 \cdot \left(x \cdot y - 1.1283791670955126 \cdot e^{z}\right)}} \]

    times-frac [=>]95.2

    \[ x + \color{blue}{\frac{--1}{-1} \cdot \frac{y}{x \cdot y - 1.1283791670955126 \cdot e^{z}}} \]
  3. Final simplification99.9%

    \[\leadsto x + \frac{-1}{\mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)} \]

Alternatives

Alternative 1
Accuracy99.0%
Cost21449
\[\begin{array}{l} t_0 := x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\ \mathbf{if}\;t_0 \leq -2 \cdot 10^{+225} \lor \neg \left(t_0 \leq 5 \cdot 10^{+185}\right):\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Accuracy99.5%
Cost13896
\[\begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;e^{z} \leq 1.00000001:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 \cdot \left(z + 1\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy86.4%
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -3.1 \cdot 10^{-30}:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-11}:\\ \;\;\;\;x + \frac{0.8862269254527579}{\frac{z + 1}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy99.4%
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -250:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-8}:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Accuracy73.8%
Cost716
\[\begin{array}{l} \mathbf{if}\;z \leq -8.2 \cdot 10^{+192}:\\ \;\;\;\;\frac{-1}{x}\\ \mathbf{elif}\;z \leq -14200000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-12}:\\ \;\;\;\;x + y \cdot 0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Accuracy86.4%
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{-26}:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-14}:\\ \;\;\;\;x + \frac{0.8862269254527579}{\frac{1}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Accuracy69.3%
Cost588
\[\begin{array}{l} \mathbf{if}\;x \leq -2.55 \cdot 10^{-172}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.55 \cdot 10^{-117}:\\ \;\;\;\;y \cdot 0.8862269254527579\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-21}:\\ \;\;\;\;\frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Accuracy86.4%
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{-27}:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 1.62 \cdot 10^{-12}:\\ \;\;\;\;x + y \cdot 0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Accuracy69.1%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{-171}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-93}:\\ \;\;\;\;y \cdot 0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy68.3%
Cost64
\[x \]

Error

Reproduce?

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