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

Error

Derivation

  1. Initial program 0.0

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

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

Alternatives

Alternative 1
Error11.3
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{+180}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{+27}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{+31}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+45}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 2
Error20.6
Cost592
\[\begin{array}{l} \mathbf{if}\;x \leq -6.3 \cdot 10^{+180}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{+28}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-47}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-10}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error1.0
Cost584
\[\begin{array}{l} t_0 := \left(1 + y\right) \cdot x\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-10}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error1.0
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;y \cdot x + x\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-10}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\left(1 + y\right) \cdot x\\ \end{array} \]
Alternative 5
Error0.0
Cost448
\[\left(x + y\right) + x \cdot y \]
Alternative 6
Error18.9
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{-47}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.3 \cdot 10^{-10}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error35.7
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2023010 
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  :precision binary64
  (+ (+ (* x y) x) y))