?

Average Error: 2.8 → 0.1
Time: 11.7s
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

Original2.8
Target0.1
Herbie0.1
\[x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x} \]

Derivation?

  1. Initial program 2.8

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

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

    [Start]2.8

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

    --rgt-identity [<=]2.8

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

    associate-+l- [=>]2.8

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

    sub-neg [=>]2.8

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

    +-lft-identity [<=]2.8

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

    sub0-neg [=>]2.8

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

    neg-mul-1 [=>]2.8

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

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

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

    +-lft-identity [=>]2.8

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

    associate-*r/ [=>]2.8

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

    sub-neg [=>]2.8

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

    +-commutative [=>]2.8

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

    neg-sub0 [=>]2.8

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

    associate-+l- [=>]2.8

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

    sub0-neg [=>]2.8

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

    neg-mul-1 [=>]2.8

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

    times-frac [=>]2.8

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

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

Alternatives

Alternative 1
Error0.2
Cost19912
\[\begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;e^{z} \leq 2:\\ \;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot 1.1283791670955126\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{0.8862269254527579}{e^{z}}\\ \end{array} \]
Alternative 2
Error0.9
Cost13636
\[\begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\ \end{array} \]
Alternative 3
Error9.5
Cost1104
\[\begin{array}{l} t_0 := x + \frac{-1}{x}\\ \mathbf{if}\;z \leq -21:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-300}:\\ \;\;\;\;x + 0.8862269254527579 \cdot \frac{y}{z + 1}\\ \mathbf{elif}\;z \leq 1.38 \cdot 10^{-241}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-130}:\\ \;\;\;\;x + y \cdot \left(0.8862269254527579 + z \cdot -0.8862269254527579\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error0.2
Cost1096
\[\begin{array}{l} \mathbf{if}\;z \leq -1260000:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 145:\\ \;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot 1.1283791670955126\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error9.5
Cost848
\[\begin{array}{l} t_0 := x + \frac{-1}{x}\\ t_1 := x + \frac{y}{1.1283791670955126}\\ \mathbf{if}\;z \leq -7.2:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-300}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.42 \cdot 10^{-241}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-129}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error9.6
Cost848
\[\begin{array}{l} t_0 := x + \frac{-1}{x}\\ \mathbf{if}\;z \leq -13:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-300}:\\ \;\;\;\;x + \frac{y}{1.1283791670955126}\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{-241}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-129}:\\ \;\;\;\;x + y \cdot 0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error9.5
Cost848
\[\begin{array}{l} t_0 := x + \frac{-1}{x}\\ \mathbf{if}\;z \leq -2.6:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-300}:\\ \;\;\;\;x + 0.8862269254527579 \cdot \frac{y}{z + 1}\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{-241}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-130}:\\ \;\;\;\;x + y \cdot 0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error0.3
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -1260000:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 340:\\ \;\;\;\;x + \frac{-1}{x + \frac{-1.1283791670955126}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Error19.6
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-152}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-276}:\\ \;\;\;\;y \cdot 0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error12.0
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -430:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error19.8
Cost64
\[x \]

Error

Reproduce?

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