Average Error: 0.0 → 0.0
Time: 6.1s
Precision: binary64
Cost: 6976
\[\left(x + y\right) \cdot \left(1 - z\right) \]
\[\mathsf{fma}\left(1 - z, x, \left(1 - z\right) \cdot y\right) \]
(FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
(FPCore (x y z) :precision binary64 (fma (- 1.0 z) x (* (- 1.0 z) y)))
double code(double x, double y, double z) {
	return (x + y) * (1.0 - z);
}
double code(double x, double y, double z) {
	return fma((1.0 - z), x, ((1.0 - z) * y));
}
function code(x, y, z)
	return Float64(Float64(x + y) * Float64(1.0 - z))
end
function code(x, y, z)
	return fma(Float64(1.0 - z), x, Float64(Float64(1.0 - z) * y))
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(1.0 - z), $MachinePrecision] * x + N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\left(x + y\right) \cdot \left(1 - z\right)
\mathsf{fma}\left(1 - z, x, \left(1 - z\right) \cdot y\right)

Error

Derivation

  1. Initial program 0.0

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

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

Alternatives

Alternative 1
Error12.5
Cost1100
\[\begin{array}{l} \mathbf{if}\;1 - z \leq -200:\\ \;\;\;\;\left(1 - z\right) \cdot x\\ \mathbf{elif}\;1 - z \leq 1.005:\\ \;\;\;\;y + x\\ \mathbf{elif}\;1 - z \leq 5 \cdot 10^{+166}:\\ \;\;\;\;\left(1 - z\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;-z \cdot x\\ \end{array} \]
Alternative 2
Error12.7
Cost1036
\[\begin{array}{l} \mathbf{if}\;1 - z \leq -200:\\ \;\;\;\;\left(1 - z\right) \cdot x\\ \mathbf{elif}\;1 - z \leq 2:\\ \;\;\;\;y + x\\ \mathbf{elif}\;1 - z \leq 5 \cdot 10^{+166}:\\ \;\;\;\;-y \cdot z\\ \mathbf{else}:\\ \;\;\;\;-z \cdot x\\ \end{array} \]
Alternative 3
Error1.6
Cost904
\[\begin{array}{l} t_0 := -\left(y + x\right) \cdot z\\ \mathbf{if}\;1 - z \leq -200:\\ \;\;\;\;t_0\\ \mathbf{elif}\;1 - z \leq 2:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error12.9
Cost652
\[\begin{array}{l} t_0 := -z \cdot x\\ \mathbf{if}\;z \leq -6 \cdot 10^{+166}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -5.1:\\ \;\;\;\;-y \cdot z\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error13.3
Cost520
\[\begin{array}{l} t_0 := -y \cdot z\\ \mathbf{if}\;z \leq -5.1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error0.0
Cost448
\[\left(x + y\right) \cdot \left(1 - z\right) \]
Alternative 7
Error34.4
Cost328
\[\begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+41}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 4.3 \cdot 10^{-102}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 8
Error23.7
Cost192
\[y + x \]
Alternative 9
Error43.1
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2023010 
(FPCore (x y z)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H"
  :precision binary64
  (* (+ x y) (- 1.0 z)))