?

Average Error: 0.0 → 0.0
Time: 22.2s
Precision: binary64
Cost: 6720

?

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

Error?

Derivation?

  1. Initial program 0.0

    \[x + y \cdot \left(z + x\right) \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, z + x, x\right)} \]
    Proof

Alternatives

Alternative 1
Error18.4
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{-10}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{+131}:\\ \;\;\;\;\left(1 + y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 2
Error12.7
Cost584
\[\begin{array}{l} t_0 := \left(x + z\right) \cdot y\\ \mathbf{if}\;y \leq -0.0042:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-77}:\\ \;\;\;\;\left(1 + y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error12.7
Cost584
\[\begin{array}{l} t_0 := \left(x + z\right) \cdot y\\ \mathbf{if}\;y \leq -0.0195:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-77}:\\ \;\;\;\;y \cdot x + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error24.6
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 4.3 \cdot 10^{-18}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 5
Error24.2
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-77}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 6
Error0.0
Cost448
\[x + y \cdot \left(z + x\right) \]
Alternative 7
Error35.0
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023033 
(FPCore (x y z)
  :name "Main:bigenough2 from A"
  :precision binary64
  (+ x (* y (+ z x))))