?

Average Accuracy: 100.0% → 100.0%
Time: 1.8s
Precision: binary64
Cost: 6720

?

\[\left(x + y\right) \cdot z \]
\[\mathsf{fma}\left(z, y, z \cdot x\right) \]
(FPCore (x y z) :precision binary64 (* (+ x y) z))
(FPCore (x y z) :precision binary64 (fma z y (* z x)))
double code(double x, double y, double z) {
	return (x + y) * z;
}
double code(double x, double y, double z) {
	return fma(z, y, (z * x));
}
function code(x, y, z)
	return Float64(Float64(x + y) * z)
end
function code(x, y, z)
	return fma(z, y, Float64(z * x))
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]
code[x_, y_, z_] := N[(z * y + N[(z * x), $MachinePrecision]), $MachinePrecision]
\left(x + y\right) \cdot z
\mathsf{fma}\left(z, y, z \cdot x\right)

Error?

Derivation?

  1. Initial program 100.0%

    \[\left(x + y\right) \cdot z \]
  2. Applied egg-rr100.0%

    \[\leadsto \color{blue}{z \cdot y + z \cdot x} \]
  3. Applied egg-rr100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, z \cdot x\right)} \]
  4. Final simplification100.0%

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

Alternatives

Alternative 1
Accuracy100.0%
Cost448
\[z \cdot x + z \cdot y \]
Alternative 2
Accuracy64.8%
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -5.4 \cdot 10^{-42}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 3
Accuracy100.0%
Cost320
\[z \cdot \left(y + x\right) \]
Alternative 4
Accuracy53.5%
Cost192
\[z \cdot y \]

Error

Reproduce?

herbie shell --seed 2023141 
(FPCore (x y z)
  :name "Text.Parsec.Token:makeTokenParser from parsec-3.1.9, B"
  :precision binary64
  (* (+ x y) z))