Average Error: 0.0 → 0.0
Time: 1.7s
Precision: binary64
\[\frac{x \cdot y}{2} - \frac{z}{8} \]
\[\mathsf{fma}\left(x, 0.5 \cdot y, z \cdot -0.125\right) \]
(FPCore (x y z) :precision binary64 (- (/ (* x y) 2.0) (/ z 8.0)))
(FPCore (x y z) :precision binary64 (fma x (* 0.5 y) (* z -0.125)))
double code(double x, double y, double z) {
	return ((x * y) / 2.0) - (z / 8.0);
}
double code(double x, double y, double z) {
	return fma(x, (0.5 * y), (z * -0.125));
}
function code(x, y, z)
	return Float64(Float64(Float64(x * y) / 2.0) - Float64(z / 8.0))
end
function code(x, y, z)
	return fma(x, Float64(0.5 * y), Float64(z * -0.125))
end
code[x_, y_, z_] := N[(N[(N[(x * y), $MachinePrecision] / 2.0), $MachinePrecision] - N[(z / 8.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x * N[(0.5 * y), $MachinePrecision] + N[(z * -0.125), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{2} - \frac{z}{8}
\mathsf{fma}\left(x, 0.5 \cdot y, z \cdot -0.125\right)

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[\frac{x \cdot y}{2} - \frac{z}{8} \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, -0.125, y \cdot \left(x \cdot 0.5\right)\right)} \]
  3. Applied egg-rr32.5

    \[\leadsto \color{blue}{{\left(\sqrt{\mathsf{fma}\left(z, -0.125, y \cdot \left(x \cdot 0.5\right)\right)}\right)}^{2}} \]
  4. Taylor expanded in z around 0 0.6

    \[\leadsto \color{blue}{{\left(\sqrt{0.5}\right)}^{2} \cdot \left(y \cdot x\right) - 0.125 \cdot z} \]
  5. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 0.5 \cdot y, z \cdot -0.125\right)} \]
  6. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot y, z \cdot -0.125\right) \]

Reproduce

herbie shell --seed 2022150 
(FPCore (x y z)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, D"
  :precision binary64
  (- (/ (* x y) 2.0) (/ z 8.0)))