?

Average Error: 0.1 → 0.0
Time: 17.5s
Precision: binary64
Cost: 6848

?

\[\frac{x \cdot y}{2} - \frac{z}{8} \]
\[\mathsf{fma}\left(y, 0.5 \cdot x, -0.125 \cdot z\right) \]
(FPCore (x y z) :precision binary64 (- (/ (* x y) 2.0) (/ z 8.0)))
(FPCore (x y z) :precision binary64 (fma y (* 0.5 x) (* -0.125 z)))
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(y, (0.5 * x), (-0.125 * z));
}
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(y, Float64(0.5 * x), Float64(-0.125 * z))
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[(y * N[(0.5 * x), $MachinePrecision] + N[(-0.125 * z), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{2} - \frac{z}{8}
\mathsf{fma}\left(y, 0.5 \cdot x, -0.125 \cdot z\right)

Error?

Derivation?

  1. Initial program 0.1

    \[\frac{x \cdot y}{2} - \frac{z}{8} \]
  2. Applied egg-rr0.0

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

Alternatives

Alternative 1
Error16.3
Cost716
\[\begin{array}{l} t_0 := \left(0.5 \cdot y\right) \cdot x\\ \mathbf{if}\;z \leq -1.02 \cdot 10^{-47}:\\ \;\;\;\;-0.125 \cdot z\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-44}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;y \ne 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot z\\ \end{array} \]
Alternative 2
Error0.1
Cost576
\[\frac{x \cdot y}{2} - \frac{z}{8} \]
Alternative 3
Error27.2
Cost192
\[-0.125 \cdot z \]

Error

Reproduce?

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