?

Average Error: 2.9 → 0.0
Time: 12.4s
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.9
Target0.0
Herbie0.0
\[x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x} \]

Derivation?

  1. Initial program 2.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)}} \]
    Proof

    [Start]2.9

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

    --rgt-identity [<=]2.9

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

    associate-+l- [=>]2.9

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

    sub-neg [=>]2.9

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

    +-lft-identity [<=]2.9

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

    sub0-neg [=>]2.9

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

    neg-mul-1 [=>]2.9

    \[ 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.9

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

    +-lft-identity [=>]2.9

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

    associate-*r/ [=>]2.9

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

    sub-neg [=>]2.9

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

    +-commutative [=>]2.9

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

    neg-sub0 [=>]2.9

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

    associate-+l- [=>]2.9

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

    sub0-neg [=>]2.9

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

    neg-mul-1 [=>]2.9

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

    times-frac [=>]2.9

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

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

Alternatives

Alternative 1
Error0.3
Cost21449
\[\begin{array}{l} t_0 := x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+258} \lor \neg \left(t_0 \leq 2 \cdot 10^{+248}\right):\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.2
Cost19912
\[\begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;e^{z} \leq 1.0002:\\ \;\;\;\;x + \frac{-1}{\left(x + -1.1283791670955126 \cdot \frac{z}{y}\right) + -1.1283791670955126 \cdot \frac{1}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{e^{z} \cdot 1.1283791670955126}\\ \end{array} \]
Alternative 3
Error0.2
Cost1352
\[\begin{array}{l} \mathbf{if}\;z \leq -232:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 13:\\ \;\;\;\;x + \frac{-1}{\left(x + -1.1283791670955126 \cdot \frac{z}{y}\right) + -1.1283791670955126 \cdot \frac{1}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error9.8
Cost1104
\[\begin{array}{l} t_0 := x + \frac{-1}{x}\\ t_1 := x + \left(y \cdot -0.8862269254527579\right) \cdot \left(-1 + z\right)\\ \mathbf{if}\;z \leq -1.65 \cdot 10^{-121}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{-292}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 10^{-143}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 10^{-15}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error0.2
Cost1096
\[\begin{array}{l} \mathbf{if}\;z \leq -75:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 13:\\ \;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot 1.1283791670955126\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error18.8
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{-225}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -5.4 \cdot 10^{-243}:\\ \;\;\;\;\frac{-1}{x}\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-290}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{-226}:\\ \;\;\;\;x + \frac{y}{1.1283791670955126}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error9.3
Cost848
\[\begin{array}{l} t_0 := x + \frac{-1}{x}\\ t_1 := x + \frac{y}{1.1283791670955126}\\ \mathbf{if}\;z \leq -8.5 \cdot 10^{-60}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-293}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-143}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.9 \cdot 10^{-14}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error0.3
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -54:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 13:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Error0.2
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -290:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 13:\\ \;\;\;\;x + \frac{-1}{x + \frac{-1.1283791670955126}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error19.0
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{-224}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{-243}:\\ \;\;\;\;\frac{-1}{x}\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-290}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-239}:\\ \;\;\;\;y \cdot 0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error19.0
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq 2 \cdot 10^{-292}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-236}:\\ \;\;\;\;y \cdot 0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 12
Error19.3
Cost64
\[x \]

Error

Reproduce?

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