Average Error: 2.9 → 0.1
Time: 3.5s
Precision: binary64
\[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
\[x + \frac{-1}{\mathsf{fma}\left(-1.1283791670955126, \frac{e^{z}}{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 -1.1283791670955126 (/ (exp z) 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(-1.1283791670955126, (exp(z) / 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(-1.1283791670955126, Float64(exp(z) / 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[(-1.1283791670955126 * N[(N[Exp[z], $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
x + \frac{-1}{\mathsf{fma}\left(-1.1283791670955126, \frac{e^{z}}{y}, x\right)}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original2.9
Target0.0
Herbie0.1
\[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.1

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

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

Reproduce

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