?

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

?

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

Error?

Derivation?

  1. Initial program 100.0%

    \[\left(x + 1\right) \cdot y - x \]
  2. Simplified100.0%

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

    [Start]100.0

    \[ \left(x + 1\right) \cdot y - x \]

    *-commutative [=>]100.0

    \[ \color{blue}{y \cdot \left(x + 1\right)} - x \]

    distribute-rgt-in [=>]100.0

    \[ \color{blue}{\left(x \cdot y + 1 \cdot y\right)} - x \]

    fma-def [=>]100.0

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

    *-lft-identity [=>]100.0

    \[ \mathsf{fma}\left(x, y, \color{blue}{y}\right) - x \]
  3. Final simplification100.0%

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

Alternatives

Alternative 1
Accuracy71.1%
Cost656
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{+65}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -3.1 \cdot 10^{+21}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{-13}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-27}:\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 2
Accuracy97.9%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+21} \lor \neg \left(y \leq 3.1 \cdot 10^{-6}\right):\\ \;\;\;\;y \cdot \left(x + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y - x\\ \end{array} \]
Alternative 3
Accuracy97.9%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+21}:\\ \;\;\;\;y + x \cdot y\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-6}:\\ \;\;\;\;y - x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x + 1\right)\\ \end{array} \]
Alternative 4
Accuracy84.4%
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{+54}:\\ \;\;\;\;y - x\\ \mathbf{elif}\;y \leq -7.5 \cdot 10^{+22}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;y - x\\ \end{array} \]
Alternative 5
Accuracy100.0%
Cost448
\[y \cdot \left(x + 1\right) - x \]
Alternative 6
Accuracy71.3%
Cost392
\[\begin{array}{l} \mathbf{if}\;y \leq -1.55 \cdot 10^{-13}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 1.52 \cdot 10^{-27}:\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 7
Accuracy43.9%
Cost64
\[y \]

Error

Reproduce?

herbie shell --seed 2023151 
(FPCore (x y)
  :name "Data.Colour.SRGB:transferFunction from colour-2.3.3"
  :precision binary64
  (- (* (+ x 1.0) y) x))