?

Average Error: 0.0 → 0.0
Time: 32.5s
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 0.0

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

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

Alternatives

Alternative 1
Error19.8
Cost1380
\[\begin{array}{l} \mathbf{if}\;y \leq -7.8 \cdot 10^{+89}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{+54}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{-9}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-70}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-16}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 0.112:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{+75}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+158}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+180}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 2
Error10.1
Cost984
\[\begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+89}:\\ \;\;\;\;y - x\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{+63}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 1100:\\ \;\;\;\;y - x\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+76}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+158}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+180}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 3
Error0.7
Cost584
\[\begin{array}{l} t_0 := \left(1 + x\right) \cdot y\\ \mathbf{if}\;y \leq -50:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.112:\\ \;\;\;\;y - x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error0.8
Cost584
\[\begin{array}{l} t_0 := \left(y - 1\right) \cdot x\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;y - x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error0.0
Cost448
\[\left(x + 1\right) \cdot y - x \]
Alternative 6
Error0.0
Cost448
\[\left(y \cdot x + y\right) - x \]
Alternative 7
Error17.9
Cost392
\[\begin{array}{l} \mathbf{if}\;x \leq -7.4 \cdot 10^{-25}:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-27}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]
Alternative 8
Error36.0
Cost64
\[y \]

Error

Reproduce?

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