Average Error: 1.6 → 1.6
Time: 3.9s
Precision: binary64
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
\[\left|\mathsf{fma}\left(\frac{-x}{y}, z, \frac{x + 4}{y}\right)\right| \]
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
(FPCore (x y z) :precision binary64 (fabs (fma (/ (- x) y) z (/ (+ x 4.0) y))))
double code(double x, double y, double z) {
	return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
double code(double x, double y, double z) {
	return fabs(fma((-x / y), z, ((x + 4.0) / y)));
}
function code(x, y, z)
	return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z)))
end
function code(x, y, z)
	return abs(fma(Float64(Float64(-x) / y), z, Float64(Float64(x + 4.0) / y)))
end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_, y_, z_] := N[Abs[N[(N[((-x) / y), $MachinePrecision] * z + N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\left|\mathsf{fma}\left(\frac{-x}{y}, z, \frac{x + 4}{y}\right)\right|

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 1.6

    \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
  2. Applied egg-rr1.6

    \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\frac{-x}{y} \cdot 1, z, \frac{x + 4}{y}\right)}\right| \]
  3. Final simplification1.6

    \[\leadsto \left|\mathsf{fma}\left(\frac{-x}{y}, z, \frac{x + 4}{y}\right)\right| \]

Reproduce

herbie shell --seed 2022172 
(FPCore (x y z)
  :name "fabs fraction 1"
  :precision binary64
  (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))