?

Average Accuracy: 99.9% → 99.9%
Time: 10.1s
Precision: binary64
Cost: 13120

?

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

Error?

Derivation?

  1. Initial program 99.9%

    \[\left(x \cdot y + z\right) \cdot y + t \]
  2. Simplified99.9%

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

    [Start]99.9

    \[ \left(x \cdot y + z\right) \cdot y + t \]

    fma-def [=>]99.9

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

    fma-def [=>]99.9

    \[ \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(x, y, z\right)}, y, t\right) \]
  3. Final simplification99.9%

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

Alternatives

Alternative 1
Accuracy60.5%
Cost720
\[\begin{array}{l} \mathbf{if}\;t \leq -5.6 \cdot 10^{-101}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-211}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{-174}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{-77}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 2
Accuracy85.0%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -2.55 \cdot 10^{+36} \lor \neg \left(y \leq 1.5 \cdot 10^{+61}\right):\\ \;\;\;\;y \cdot \left(z + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t + y \cdot z\\ \end{array} \]
Alternative 3
Accuracy91.8%
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -3.15 \cdot 10^{-21} \lor \neg \left(z \leq 2 \cdot 10^{+20}\right):\\ \;\;\;\;t + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t + y \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 4
Accuracy78.0%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{-266} \lor \neg \left(z \leq 5.6 \cdot 10^{-306}\right):\\ \;\;\;\;t + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 5
Accuracy99.9%
Cost576
\[t + y \cdot \left(z + x \cdot y\right) \]
Alternative 6
Accuracy60.6%
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -1.1 \cdot 10^{-100}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{-78}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 7
Accuracy53.4%
Cost64
\[t \]

Error

Reproduce?

herbie shell --seed 2023151 
(FPCore (x y z t)
  :name "Language.Haskell.HsColour.ColourHighlight:unbase from hscolour-1.23"
  :precision binary64
  (+ (* (+ (* x y) z) y) t))